Created
October 18, 2013 15:03
-
-
Save hara/7042908 to your computer and use it in GitHub Desktop.
Windows で %PATHEXT% を利用した which コマンド ref: http://qiita.com/hara/items/37d2659b050269352135
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SYNOPSIS | |
which [-a] filename | |
OPTIONS | |
-a 見つかった全ての実行可能ファイルを表示する。 | |
EXIT STATUS | |
0 指定した全てのコマンドが見つかった | |
1 指定したいずれかのコマンドが見つからなかった | |
2 不正なオプションを指定した |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C:\Users\foo> for %i in (foo.exe foo.bat) do echo %i | |
foo.exe | |
foo.bat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C:\Users\foo>echo %PATHEXT% | |
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set COMMANDS=;%PATHEXT% | |
=> ";.EXE;.BAT" | |
call set COMMANDS=%%COMMANDS:;= %~1%% | |
=> " foo.EXE .foo.BAT" | |
set COMMANDS=(%COMMANDS:~1%) | |
=> "(foo.EXE foo.BAT)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C:\Users\foo>which notepad ipconfig | |
C:\Windows\System32\notepad.exe | |
C:\Windows\System32\ipconfig.exe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment