2014-09-29 128 views
0

我在我的系统的PATH变量中包含几个文件夹,其中包含具有相同名称的exe文件。所以当我打开一个cmd并输入这个exe程序的名字时,我想知道它从哪个目录打开这个exe文件。我怎么能做到这一点?可执行文件的路径

回答

0

where your_exe会告诉你shell将使用的your_exe的版本。

+0

好了,我有文件夹,此命令和CMD的输出将来自首批上市的目录下运行exe文件的列表。这是对的吗? – 2014-09-29 22:00:52

+0

在这里看到一个命令,告诉你哪个文件将被执行。我没有检查过它是否是第一个(虽然我怀疑它是)http://ss64.com/nt/syntax-which.html – John3136 2014-09-29 22:04:15

0

的批处理文件:

@echo off 
echo. 
echo PathFind - Finds the first file in in a path 
echo ======== = ===== === ===== ==== == == = ==== 
echo. 
echo Searching for %1 in %path% 
echo. 
set a=%~$PATH:1 
If "%a%"=="" (Echo %1 not found) else (echo %1 found at %a%) 
相关问题