ãç¶ã ã ã ããã£ã¬ã¯ããªãã©ããã®å¤æãwhichã³ãã³ãã®æ¹è¨ç
以åã®è¨äºã«ããã¦ã
æ¨æ¥ã®è¨äºã«å¯¾ãã
ç§ã¯ãdir "対象" /a:d ãã¦ã¿ã¦ errorlevel ãè¦ã¾ãã NUL ã«é ¼ããã確å®ã§ã¯ï¼
ã¨ããã³ã¡ã³ããé ããããã ãif existã§ä¸æ°ã«ãã§ãã¯ã§ããã³ã³ãã¯ããã¯æ¨ã¦ããããã¨ãããã¨ã§ãããå°ããããã¦ã¿ã¾ããã
ã¨ãããã¨ã§ã
if exist "%%A" if not exist "%%A\" echo æ®éã®ãã¡ã¤ã«
ã¨ããæ¹æ³ãåã£ãããããã|| ã使ãã¨ãã³ã³ãã¯ãããæãªããã« dir ã使ãæ¹æ³ãåããã
if exist "%%A" dir /b/ad "%%A" >NUL 2>NUL||echo æ®éã®ãã¡ã¤ã«
ã§ããã/b ã¯å¿
é ã§ã¯ãªãããããã«éããªããããã¨å
ã®æ¹å¼ã使ã£ã which.bat ã®å¦çæéãæ¯ã¹ã¦ã¿ãã
exist æ¹å¼ã 0.2 ç§ã§ãdir æ¹å¼ã 0.4 ç§ã§ãããæéèªä½ã¯ PATH ã PATHEXT ã®è¦ç´ æ°ã«ä¾åããããããã«ãã¦ã exist æ¹å¼ã®ã»ããéãããã ã
ãããã®å·®ã§ã¯ãããã0.2 ç§ã ã¨ç¬éçã«çµããã®ã«å¯¾ãã¦ã0.4 ç§ã ã¨ã¡ãã£ã¨ããã¤ãæãã§ãããPenIII/650MHzã§ã®çµæãªã®ã§ããã£ã¨éãCPUã 㨠dir æ¹å¼ã§ãæ°ã«ãªããªããããããªããã¢ã³ããã¥ã¡ã³ãã®æ©è½ã使ããªãããã ãã
ç§ã®å ´åã¯å½é¢ exist æ¹å¼ã使ãç¶ãããã¾ããåããããªå¦çã4ååºã¦ããã®ã§ããããµãã«ã¼ãã³ã«ãã¦ã¿ãããå¦çæéã 0.8 ç§ã¨ããªãé·ããªããã½ã¼ã¹ã¯è¦ããããªããããã§ã¯ããã¤ããæ°ã«ãªãã®ã§ããµãã«ã¼ãã³åã¯ããªããã¨ã«ããã
é«éCPUã®äººã¯ãdir æ¹å¼ & ãµãã«ã¼ãã³æ¹å¼ã®ã»ããã½ã¼ã¹ãè¦ãããã ããã
ãã¼ããPCã®è²·ãæ¿ãæããªããããé«éCPU使ç¨è
åãã«ä¸å¿ç´¹ä»ããã
@echo off for %%X in (%*) do ( ãfor /f "delims=" %%A in ('DOSKEY /MACROS') do ( ããfor /f "delims==" %%B in ("%%A") do if /i "%%B" == "%%X" echo %%A ã) ãfor %%A in (ASSOC BREAK CALL CD CHDIR CLS COLOR COPY DATE DEL DIR ECHO ããENDLOCAL ERASE EXIT FOR FTYPE GOTO IF MD MKDIR MOVE PATH PAUSE POPD ããPROMPT PUSHD RD REM REN RENAME RMDIR SET SETLOCAL SHIFT START TIME ããTITLE TYPE VER VERIFY VOL) do if /i "%%X" == "%%A" echo %%X cmd.exe builtin ãif not "%%~xX" == "" call :sub "%%~X" ãfor %%S in (%PATHEXT%) do call :sub "%%~X%%S" ãset _= ãif "%%~X" == "%%~nxX" ( ããfor %%P in ("%PATH:;=";"%") do ( ãããif not "%%~xX" == "" call :sub "%%~P\%%~X" ãããfor %%S in (%PATHEXT%) do call :sub "%%~P\%%~X%%S" ãã) ã) ) if not defined _ goto :eof if not "%_%" == "%_: =%" set _="%_%" goto :eof :sub if exist "%~1" dir /b/ad "%~1" >NUL 2>NUL||(echo %~1&if not defined _ set "_=%~1")
以åæ¸ãããã®ããã¯ãseltlocal ã使ããªããªã©è¥å¹²æ¹åãã¦ããã
2004-09-25 誤ãããã£ãã®ã§å°ãä¿®æ£