2019獨角獸企業重金招聘Python工程師標準>>>
Linux有個Which命令,用來查找可執行文件的位置。
linux查找文件路徑的命令?例如:which find, 就會從PATH變量的路徑里搜索該命令,返回找到的第一個匹配的結果。
這樣我們就可以知道,我們用的find程序是哪里的。
Windows沒有這樣的指令,我們可以自己寫一個:
@echo off
echo %~dp$PATH:1
@echo on
linux復制文件命令。
?
其它的方法:
apropos命令。
1.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.
2.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
whereis命令,
3.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.
?
轉自網絡。
?