2011-09-09 19 views

回答

1

在UNIX上,你可以運行命令which perl,如果它返回什麼,那麼你知道你有一個有效的文件。

$ which ftp 
/usr/bin/ftp 
$ which noexist 
which: 0652-141 There is no noexist in /usr/local/bin /usr/dlc/bin /usr/bin /etc 
/usr/sbin /usr/ucb /home/glowcoder/bin /usr/bin/X11 /sbin .. 
$ 
+3

PowerShell中的等效命令爲Get-Command –

+1

爲了防萬一有一個帶有該名稱的函數,請務必嘗試「Get-Command perl.exe」。 – JasonMArcher

+0

IMO,這完全不是對這個問題的答案。既不能在cmd上運行,也不能在Powershell上運行。雖然它確實提供了一個方法來做到這一點。 – manojlds

1

在Windows CMD,你會使用where命令,它是在* nix中的 「等效」 的which

不幸的是,你不能使用它一樣,在PowerShell中,因爲在PowerShell中,where是別名Where-Object

一旦選擇是稱其爲where.exe

where.exe perl 

請注意,這是基於該exe /程序正在PATH上。

Get-command是Powershell中的「等價物」,當然它更強大。

相關問題