2003-08-01ãã1ã¶æéã®è¨äºä¸è¦§
å¤æ°ã®ç½®æãæ§æ解æã®é åºã ãããããããã£ã¦ã¿ãçµæ次ã®ããã§ããã (1) ç°å¢å¤æ°ã®ç½®æãå¼æ°ã®ç½®æãåé åºã§æå (2) if/for/( ) çã®æ§é ãæã£ãæã®æ§æ解æãããã³ãªãã¤ã¬ã¯ãã®å¤æçãåé åº (3) forå¶å¾¡å¤æ°ã®ç½®æ (4) ç°å¢å¤æ°é 延å±éâ¦
8/15ï¼ ãç¶ãã¹ã¯ãªããä¸ã®æªå®ç¾©ç°å¢å¤æ°ã®è¬ã§ã ï¼ãã¹ã¯ãªããä¸ã®ä»»æã®å ´æã«ã%" 㨠"%ã§å²ãã ã³ã¡ã³ããæ¸ãããã¨ãããã¨ã ã ã¨æ¸ããããã¡ãã£ã¨ééã£ã¦ããã%" "% ã§å²ãã¨ããããã¯ã% % ã§å²ã¾ãã¦ããã°ããããã®æãã¹ãããéã«ã¯â¦
æ¨æ¥ã®è¨äºã«å¯¾ãã >ç§ã¯ãdir "対象" /a:d ãã¦ã¿ã¦ errorlevel ãè¦ã¾ãã NUL ã«é ¼ããã確å®ã§ã¯ï¼ ã¨ããã³ã¡ã³ã*1ãé ãããDOSã®æ代ããããã£ã¬ã¯ããªã®ãã§ãã¯ã¯\NULã使ã£ã¦ãããã®ã¨ããå å ¥è¦³ãæã£ã¦ããã ãã¾ããdirã³ãã³ãã«ã/adãªâ¦
ä½èª¿ãæªã(å é±é?åã¯38度ã®ç±ã§ããªããªããå¯ã¦ãã)ã®ã§ãå°ãã¿ã 7/28ï¼ãã£ã¬ã¯ããªãã©ããã®å¤æã§ããã¹ã " " ã§å²ã¾ããã¨ãif exist ã«ããã \NULã®åå¨ãã§ãã¯ããã¾ãè¡ããªããã¨ã«å¯¾ãã対çãæ¸ãããï¼(1) forå¶å¾¡å¤æ°ã«ãããã·ã§ã¼â¦
ãã¸TVã®çªçµã§ã¯ã¤ãºãããµã´ã³ã¨ããã®ããããå é±ã®çªçµã§ããæ¸è°·å¥³åé«ç70%ã(ãããããã80%ã ã£ããã)ãæ£è§£ããåé¡ã¨ãã¦ç´¹ä»ãããã®ãããå°æ³é¦ç¸ã®åã®é¦ç¸ã¯ï¼ãã¨ããåé¡ãä¸ä»£åã ãããããªã«é£ãããã¨ã¯ç¡ãã¨ãã¦ããæ¸è°·å¥³åé«çâ¦
æ¨æ¥æ¸ãã %" "% ã®ã³ã¡ã³ãã«æ©è½ã«çµ¡ãã§ã" " ã«å²ã¾ããç°å¢å¤æ°åã使ããªããã®ããã£ã¦ã¿ãããã set "AA"=123 ç°å¢å¤æ° AA ãå®ç¾©ããã¦ãã¾ãã ã¨ãªããã¤ã¾ãã set AA ã¨åãçµæã«ãªããã¤ãã§ã«ã set ""=123 ããã£ã¦ã¿ãã¨ãããset ã¨åâ¦
æ¨æ¥ã®ç¶ãã§ããã ç°å¢å¤æ°åã«ç©ºç½ãå«ã¾ãã¦ãè¯ãã¨ããæ°åã§ãè¯ãã¨ãæ¸ããããæ¥æ¬èªããã¡ããOKã®ããã§ããã ã¾ãããã¤ãã®è¨å·ã使ããããªã㨠% ã使ãããã¹ã¯ãªããä¸ã§ã¯ã% 㯠%% ã¨æ¸ãã®ã§ã以ä¸ã®ããã«ãªãã setlocal enabledelaâ¦
æ¨æ¥ãã¹ã¯ãªããä¸ã§ã®æªå®ç¾©ç°å¢å¤æ°ã®æ¯ãèããè¯ãããããªãã¨æ¸ããã å®é set _= if defined _ if not "%_%" == "%_: =%" set _="%_%"</b> ã¨æ¸ãã¦å®è¡ããã¨ã ã³ãã³ãã®æ§æã誤ã£ã¦ãã¾ãã if defined _ if not "" == " =_" ã¨ãªã£ã¦ãã¾ãããªãâ¦
ã³ã¡ã³ã*1ã«ã¯ã³ã¡ã³ãã§ã¨æãã¾ããããæ¬æã®ãã¿ãç¡ãã®ã§æ¬æã§ãè¿äºãã¾ããï¼ãããã³ãã³ãã¹ã¯ãªããã§å人ç¨ãã¼ã«ãã¡ããã¡ããçµãã§ãããã®ã§ããé·ããã®ã 㨠2000è¡è¿ããªããã¨ãããã¾ããããã«ã¯é©ãã¾ãããBATã«ãã®ã¬ãã«ã®ãã®â¦
æçµåã¯æ®ãã®é¨åã1åç®ã®ä»æ§ã§æ¸ããã (5) PATHããµã¼ããã¦è¦ã¤ããæåã®å®è¡ãã¡ã¤ã«ã®ãã«ãã¹ãç°å¢å¤æ°ã _ ãã«ã»ãããã ã®é¨åã§ããããæå¾ãªã®ã§å ¨æãæ²è¼ãããä¾ã«ãã£ã¦ã¤ã³ãã³ãã¯2ãã¤ã空ç½ãªã®ã§ã³ãã¼ãã¼ã¹ããã人ã¯æ³¨æãPAâ¦
5åç®ã¯ãPATHç°å¢å¤æ°ã®ãµã¼ããåºæ¬çã«ã¯ååã¨åããã§ãã¯ããPATHã®å 容ãé 次ä»å ããªããè¡ã£ã¦ãããä»åã¯æåã«ã¹ã¯ãªããã示ãã å ¨ä½ã«ã¤ãã¦ã¯2åç®ãåç §ãããã§æ¸ããããã¹ã®ãµã¼ããã¨ããã®ã以ä¸ã§ãããå ¥åãããæååã¯ã%%Xã«å ¥â¦
4åç®ã¯ãPATHç°å¢å¤æ°ã使ã£ããµã¼ãã®åã«cmd.exeãè¡ãå®è¡ãã¡ã¤ã«ãã§ãã¯ã®é¨åã«ã¤ãã¦ã ãã®ã±ã¼ã¹ã«ã¯ã (1) ã³ãã³ãã¨ãã¦å ¥åãããæååããã®ã¾ã¾å®è¡ãã¡ã¤ã«åã§ããå ´å (2) ã³ãã³ãã¨ãã¦å ¥åãããæååã«PATHEXTã®å 容ãä»å ãããâ¦
3åç®ã¯ãDOSKEYãã¯ãã®ãµã¼ãã§ãããé¢é£ããã¹ã¯ãªããé¨åã以ä¸ã«ç¤ºãã2åç®ãåç §ã 01 ãåå¦çã 02 for %%X in (%*) do ( 03 for /f "delims=" %%A in ('DOSKEY /MACROS') do ( 04 for /f "delims==" %%B in ("%%A") do if /i "%%B" == "%%X" echâ¦
8/5è¨äºã«ããã¦ãã£ããã®ãã¢ããããæ¨æºå ¥åã®èªã¿åãã§ã¯ããããã¡ãã£ã¨æãã¤ããã®ã§ãWHICHã³ãã³ãã®é£è¼ãä¸æãã¦ãã£ã¡ãæ¸ããset /pã«ããæ¨æºå ¥åèªã¿åãã«ããã¦ç©ºè¡ã¨EndOfFileãåºå¥ã§ããªãã®ã¯ç¢ºãã§ããããããã空è¡ã«ã¯æ¬¡ã«ããâ¦
æ¨æ¥ã®1åç®ã¯DOSKEYã®èª¬æã§ç²ããã®ã§ä»æ¥ã®ã2åç®ã¯è»½ããå ¨ä½ã®ã¡ã¤ã³ã«ã¼ãã¨ãæ¯è¼çç°¡åãªãã«ãã¤ã³ã³ãã³ããµã¼ãé¨åãæ¸ããã ãã®é¨åã¯3åç®ä»¥éã®èª¬æã§ããã便å®ä¸ãè¡çªå·ãã¤ããã 01 @echo off 02 set _= 03 setlocal 04 set BLT=ASSOâ¦
å®é¨ã®ãã¿ãå°½ãã¦ããã®ã§ãããããä½åãã«åãã¦èªä½ã®WHICH.BATã¨ããã¹ã¯ãªããã®è§£èª¬ã§ãããããã¨æãã¾ãã ã¾ãã¯ãä»æ§ããã unixã«whichã¨ããã³ãã³ãããããã·ã§ã«ãã³ãã³ããå®è¡ããéã«PATHç°å¢å¤æ°ããµã¼ããããããã®å®éã«å®è¡ãâ¦
7/21æ¨æºå ¥åããã®èªã¿åãã«ããã¦ãset /p ã³ãã³ãã«ããæ¨æºå ¥åããã®èªã¿åãããã¤ãããè¡ã£ãå ´åãã¿ã¤ãã³ã°ãåããªãã®ã§æ°è¡ããã«ããèªããªãã¨æ¸ãããããã確ããã¦ã¿ãã 1è¡åºåãã¨ã«1ç§å¾ ã¤ããã°ã©ã ãä½æããã(ããã°ã©ã ã¯ããªâ¦