码迷,mamicode.com
首页 > Windows程序 > 详细

Windows中查找命令的路径 (类似Linux中的which命令)

时间:2015-12-02 22:38:07      阅读:295      评论:0      收藏:0      [点我收藏+]

标签:

where is a direct equivalent:

C:\Users\Joey>where cmd
C:\Windows\System32\cmd.exe
Note that in PowerShell where itself is an alias for Where-Object, thus you need to usewhere.exe in PowerShell.

In cmd you can also use for:

C:\Users\Joey>for %x in (powershell.exe) do @echo %~$PATH:x
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
In PowerShell you have Get-Command and its alias gcm which does the same if you pass an argument (but also works for aliases, cmdlets and functions in PowerShell):

PS C:\Users\Joey> Get-Command where

CommandType Name Definition
----------- ---- ----------
Alias where Where-Object
Application where.exe C:\Windows\system32\where.exe
The first returned command is the one that would be executed.

 

Windows中查找命令的路径 (类似Linux中的which命令)

标签:

原文地址:http://www.cnblogs.com/johnsonshu/p/5014133.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!