Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
366 views
in Technique[技术] by (71.8m points)

windows - 在Windows命令行上是否有相应的“哪个”?(Is there an equivalent of 'which' on the Windows command line?)

As I sometimes have path problems, where one of my own cmd scripts is hidden (shadowed) by another program (earlier on the path), I would like to be able to find the full path to a program on the Windows command line, given just its name.

(由于我有时遇到路径问题,其中一个我自己的cmd脚本被另一个程序隐藏(阴影)(在路径的前面),我希望能够在Windows命令行上找到程序的完整路径,给定只是它的名字。)

Is there an equivalent to the UNIX command 'which'?

(有没有相当于UNIX命令'哪个'?)

On UNIX, which command prints the full path of the given command to easily find and repair these shadowing problems.

(在UNIX上, which command打印给定命令的完整路径,以便轻松查找和修复这些阴影问题。)

  ask by namin translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Windows Server 2003 and later (ie anything after Windows XP 32 bit) provide the where.exe program which does some of what which does, though it matches all types of files, not just executable commands.

(Windows Server 2003和更高版本(如Windows XP 32位之后的任何东西)提供where.exe程序,做什么一些which呢,虽然它匹配所有类型的文件,而不只是执行命令。)

(It does not match built-in shell commands like cd .) It will even accept wildcards, so where nt* finds all files in your %PATH% and current directory whose names start with nt .

((它与cd类的内置shell命令不匹配。)它甚至会接受通配符,因此where nt*查找%PATH%和当前目录中名称以nt开头的所有文件。)

Try where /?

(试试where /?)

for help.

(求助。)

Note that Windows PowerShell defines where as an alias for the Where-Object cmdlet , so if you want where.exe , you need to type the full name instead of omitting the .exe extension.

(请注意,Windows PowerShell将Where-Object cmdlet的别名定义where Where-Object ,因此如果您需要where.exe ,则需要键入全名而不是省略.exe扩展名。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...