ãã¯ãããããã¾ããããããã§ãã
ããããç¹éãã®ç¬¬7å
ä»åã®ãã¼ã㯠ç°å¢å¤æ° ã§ãã
ããã§ã¯æ©éè¡ã£ã¦ã¿ã¾ãããï¼
- ç°å¢å¤æ°ã®å©ç¨
- ç°å¢å¤æ°ã®ã¹ã³ã¼ã
- ç¥ã£ã¦ãã¨ä¾¿å©ãªç°å¢å¤æ°
- ä½è«ãï¼ã¹ãããOKï¼
- ãããã«
Â
ãã注æã
æ¬ãµã¤ããåèã«ä½æãããã®ã¯ãèªå·±è²¬ä»»ã§ãé¡ããã¾ãã
å®è¡åã®ã¬ãã¥ã¼ããã¹ããå¿
ãå®æ½ãã¦ãã ããã
ããã§ã¯ãä»åããããããé¡ããã¾ãã
ç°å¢å¤æ°ã®å©ç¨
ç®ç
ç°å¢å¤æ°ã¯ç°¡åã«è¨ãã¨ãããã®ä¸ã§æ±ãå¤æ°ã¨èãã¦åé¡ããã¾ããã
ï¼ä¸è¬çãªããã°ã©ã è¨èªã§ä½¿ç¨ããå¤æ°ã¿ãããªãã®ï¼
ã¦ã¼ã¶ãè¨å®ããç°å¢å¤æ°ã¯ãã¦ã¼ã¶ç°å¢å¤æ°ãã¨å¼ã°ãã¾ãã
ã·ã¹ãã èµ·åæã«è¨å®ãããç°å¢å¤æ°ãããã¾ãã
å
·ä½çã«ã¯ã"PATH" ã "TEMP" ãªã©ãããã«è©²å½ãã¾ãã
ãã¡ãã¯ããã·ã¹ãã ç°å¢å¤æ°ãã¨å¼ã°ãã¾ãã
ç°å¢å¤æ°ã®è¨å®ã¯ SETã³ãã³ãã使ç¨ãã¾ãã
SETã³ãã³ã è¨è¿°æ¹æ³
  SET ç°å¢å¤æ°å=[å¤]
Â Â ï¼ [ ]é¨åã¯çç¥å¯è½ ï¼
SETã³ãã³ãã¯ãããããã¡ã¤ã«å ã«è¨è¿°ãã§ããã³ãã³ãããã³ããã§ç´æ¥å ¥åããã³ãã³ãã¨ãã¦ã使ç¨ã§ãã¾ãã
ç°å¢å¤æ°ã®åç §æ¹æ³
ç°å¢å¤æ°åã"%"ã§å²ãã§è¨è¿°ãããã¨ã§ããããå®è¡æã«ãã® %ç°å¢å¤æ°å% é¨åãè¨å®ããã¦ããå¤ã«ç½®ãæããã¾ãã
(eg) ç°å¢å¤æ°åã"@AAA"ã®å ´åã%@AAA% ã§åç §ã§ãã¾ãã以ä¸ã¯ç°å¢ç·¨ã®å 容ã表示ãããµã³ãã«ã§ãã
  echo %@AAA%
解説ãè¬éã
â SETã³ãã³ãã§å¤ãæå®ããå ´å
左辺ã®ç°å¢å¤æ°ã«å³è¾ºã®å¤ãè¨å®ããã¾ãã
ç°å¢å¤æ°ãæ°è¦ã®å ´åã¯æ°ãã«ç°å¢å¤æ°ãç¨æãå¤ãè¨å®ããã
æ¢åã®å ´åã¯å¤ãæå®ããå
容ã«å¤æ´ããã¾ãã
â SETã³ãã³ãã§å³è¾ºã®å¤ãçç¥ããå ´å
左辺ã®ç°å¢å¤æ°ã¯åé¤ããã¾ãã
ç°å¢å¤æ°ã®ã¹ã³ã¼ã
ç°å¢å¤æ°ã®ã¹ã³ã¼ãã¨ã¯ãè¨å®ããç°å¢å¤æ°ã®æå¹ç¯å²ã®ãã¨ã§ãã
ããã§ã¯ãWindows7以éã®Windowsç°å¢ãåæã«èª¬æãã¾ãã
ç°å¢å¤æ°ãä½æããã³ãã³ãããã³ããã®ä¸ã§ãç°å¢å¤æ°ãåé¤ã¾ã§æå¹ã«ãªãã¾ãã
ï¼å¥ã¦ã£ã³ãã¦ã®ã³ãã³ãããã³ããã¯ç¯å²å¤ã¨ãªãã¾ããï¼
ç°å¢å¤æ°ã®ã¹ã³ã¼ããã©ããªã£ã¦ããããµã³ãã«ã³ã¼ãã使ã£ã¦èª¬æãã¾ãã
ãµã³ãã«(1)
2ã¤ã®ããããã¡ã¤ã«ï¼a.batã¨b.batï¼ãä½æãã¾ãã
@echo off cd /d %~dp0 set @test=ç°å¢å¤æ° echo *** a.bat ***************** echo @test : %@test% echo ***************************
ãã®ãµã³ãã«ã³ã¼ããé©å½ãªãã©ã«ãã«ãa.bat ã¨ãããã¡ã¤ã«åã§ä¿åãã¦ãã ããããã¡ãããæåã³ã¼ãã¯ANSIã§ãã
@echo off cd /d %~dp0 echo *** b.bat ***************** echo @test : %@test% echo ***************************
ãã®ãµã³ãã«ã³ã¼ããa.batãä¿åãããã©ã«ãã«ãb.bat ã¨ãããã¡ã¤ã«åã§ä¿åãã¦ãã ããããã¡ãããæåã³ã¼ãã¯ANSIã§ãã
ä½æãããµã³ãã«ãå®è¡ãã¦ã¿ã¾ãã
ã解説ã
â ãa.batãå®è¡ãããã¨ã§ãç°å¢å¤æ°"@test"ã«å¤ãè¨å®ããã¾ãã
â¡ãb.batãå®è¡ãã¾ããb.batã§ã¯ç°å¢å¤æ°"@test"ã®å
容ã表示ãã¾ãã
â¢ãsetã³ãã³ãã§ç°å¢å¤æ°"@test"ã®å
容ãç´æ¥ç¢ºèªãã¾ãã
â£ãç°å¢å¤æ°"@test"ã®å
容ãã¯ãªã¢ãã¾ããï¼ç°å¢å¤æ°ã®åé¤ï¼
â¤ãç°å¢å¤æ°"@test"ã®å
容ãb.batã§è¡¨ç¤ºãã¦ã¿ã¾ãã
ãµã³ãã«(2)
2ã¤ã®ããããã¡ã¤ã«ï¼c.batã¨d.batï¼ãä½æãã¾ãã
@echo off cd /d %~dp0 set @test=ç°å¢å¤æ° echo *** c.bat ***************** echo @test : %@test% echo *************************** cmd /c .\d.bat
ãã®ãµã³ãã«ã³ã¼ããé©å½ãªãã©ã«ãã«ãc.bat ã¨ãããã¡ã¤ã«åã§ä¿åãã¦ãã ããããã¡ãããæåã³ã¼ãã¯ANSIã§ãã
@echo off cd /d %~dp0 echo *** d.bat ***************** echo @test : %@test% echo ***************************
ãã®ãµã³ãã«ã³ã¼ããc.batãä¿åãããã©ã«ãã«ãd.bat ã¨ãããã¡ã¤ã«åã§ä¿åãã¦ãã ããããã¡ãããæåã³ã¼ãã¯ANSIã§ãã
ä½æãããµã³ãã«ãå®è¡ãã¦ã¿ã¾ãã
ã解説ã
â ãc.batãå®è¡ãããã¨ã§ãç°å¢å¤æ°"@test"ã«å¤ãè¨å®ããã¾ãã
ããc.batããå¼ã³åºãããd.batã§ç°å¢å¤æ°"@test"ã®å
容ã表示ãã¾ãã
â¡ãsetã³ãã³ãã§ç°å¢å¤æ°"@test"ã®å
容ãç´æ¥ç¢ºèªãã¾ãã
â¢ãç°å¢å¤æ°"@test"ã®å
容ãã¯ãªã¢ãã¾ããï¼ç°å¢å¤æ°ã®åé¤ï¼
â£ãç°å¢å¤æ°"@test"ã®å
容ãb.batã§è¡¨ç¤ºãã¦ã¿ã¾ãã
ãµã³ãã«(2)ã¯ãç°å¢å¤æ°ãä½æããã³ãã³ãããã³ããããèµ·åããã³ãã³ãããã³ããï¼ãã£ã¤ã«ãããã»ã¹ï¼ã§ç°å¢å¤æ°ã®å 容ãå¼ãç¶ããããã¨ã確èªã§ãã¾ãã
ç¥ã£ã¦ãã¨ä¾¿å©ãªç°å¢å¤æ°
Windowsãèµ·åããéã«ãããããè¨å®ããã¦ããç°å¢å¤æ°ã®ãã¡ããããä½æã®ããã§ä¾¿å©ãªãã®ãããã¤ãç´¹ä»ãã¾ãã
ã»ãCOMPUTERNAME : ãã·ã³å
ã»ãUSERNAME : ã¦ã¼ã¶å
ã»ãUSERPROFILE : ã¦ã¼ã¶ãããã¡ã¤ã«ãã©ã«ããï¼C:\Users\ãã¦ã¼ã¶åã
ã»ãUSERDOMAIN : ãã°ãªã³ãã¦ãããã¡ã¤ã³åãï¼ããã¡ã¤ã³åãï¼
ã»ãTEMP : TEMPãã©ã«ãã®ãã¹ãï¼%USERPROFILE%\AppData\Local\Tempï¼
ã»ãTMP : TEMPãã©ã«ãã®ãã¹ãï¼%USERPROFILE%\AppData\Local\Tempï¼
ã»ãwindir : Windowsãã¤ã³ã¹ãã¼ã«ããã¦ãããã¹ãï¼%SystemRoot%ï¼
ã»ãOS : OSå称ãï¼Windows_NTï¼
ãã®ã»ãã«ãããããã®ç°å¢å¤æ°ãè¨å®ããã¦ãã¾ãã確èªããã«ã¯ãã³ãã³ãããã³ãããéããå¼æ°ãªãã§SETã³ãã³ããå®è¡ãã¦ã¿ã¦ãã ããã
ä½è«ãï¼ã¹ãããOKï¼
ä¸è¨ã®èª¬æã®ä¸ã§ãç°å¢å¤æ° OS ã¨ããã®ãããã¾ããã
è¨å®ããã¦ããå¤ã¯ã"Windows_NT" ã§ãã
ã¯ã¦ããã®ãNTãã£ã¦ä½ã ãï¼
ã¨æãããæ¹ã¯ããªãå¤ãã®ã§ã¯ã¨æãã¾ãã
æã
ããã®ã¾ã大æ
Windowsã¯2種é¡ããã¾ããã
ã²ã¨ã¤ã¯ãMS-DOSä¸ã§åãGUIã¢ããªã±ã¼ã·ã§ã³ã§ããWindows1.0ããå§ã¾ããæ¥æ¬ã§æ®åããã®ã¯Windows3.1ã§ãã
ãã®å¾ãWindows95ï¼Windows4.0ï¼ã§ä¸æ°ã«ãã¬ã¤ã¯ãã¾ããããã®ã¨ããPCã®èµ·åã§Windowsãç´æ¥èµ·åããããã«ãªãã¾ããã
ãããããã®ç³»çµ±ã®Windowsï¼ä»¥éãWindows9xç³»ï¼ã¯ãMS-DOSãæ¡å¼µã»çºå±ãã¦ãããã®ã§ãããåºæ¬çã«ã¯ã·ã³ã°ã«ã¦ã¼ã¶ãã·ã³ã°ã«ã¿ã¹ã¯ãã¼ã¹ã®ãã®ã§ããã
ãã®ç³»çµ±ã¯ã1.0(1985å¹´)â2.0â3.0/3.1â95â98/98SEâMe(2000å¹´) ã§çµäºãã¾ããã
ããã«å¯¾ãããã«ãã¿ã¹ã¯ããã«ãã¦ã¼ã¶ãåæã«éçºãããæ°ããWindowsï¼New Technologyï¼è«¸èª¬ããï¼ï¼ã§ãæåã®ãã¼ã¸ã§ã³ã¯ Windows NT Advanced Server 3.1 ã§ãµã¼ãåãOSã§ããã
ãã®å¾ãã¯ã©ã¤ã¢ã³ãåãã¨ãã£ã·ã§ã³ã追å ãã Windows NT 3.5ãç»å ´ãWindows95ã¨UIãå
±éåããWidnows NT 4.0ã¨é²åãã¾ãã
ãã¡ãã®ç³»çµ±ï¼NTç³»ï¼ã®ãµã¼ãç³»ã¯ãNT3.1âNT3.5/3.51âNT4.0â2000â2003/2003R2â2008/2008R2â2012/2012R2â2016â2019â2022 ã¨é²åãç¶ãã¦ãã¾ãã
ã¯ã©ã¤ã¢ã³ãç³»ã¯ãNT3.5/3.51âNT4.0â2000âXPâVistaâ7â8/8.1â10â11ã¨é²åãã¦ãã¾ãã
ãã®ãããªæµãã§æ¥ã¦ãã¾ãããã³ã³ã·ã¥ã¼ãåãã§æ®åããæµãã¯
Widnows95 â Windows98 â WindowsXP â Windows7 â Windows10ãã§ã¯ãªãã§ãããããã¦ã¼ã¶ã¯ç¥ããªããã¡ã«XPããNTç³»ã®Windowsã«å¤ãã£ã¦ããã®ã§ãã
éä¸é£ãã§ããã®ã¯æè¬ãä¸è©ãã ã£ãWindowsã§ããWidnows11ã¯ã©ããªãã§ããããããã
ã¡ãªã¿ã«ããããã¯ãWindows3.0/3.1ã¨ãã以éã®9xç³»ãããã¦NTç³»ã¯NT3.1ããæ§ã
ãªéçºããã£ã¦ãã¾ããã
ä»ã§ããé«æ§è½ãªããã»ããµã®ç»å ´ã§ãããããªãã¨ãã§ããããã«ãªãã¾ããããå½æ NT3.1 ãåããç°å¢ãæºåããã«ã¯è«å¤§ãªè²»ç¨ã¨é«åº¦ãªè¨å®æè¡ãå¿
è¦ã§ããã
æãããã§ãã
ãConfigè·äººãã¨å¼ã°ããã¨ã³ã¸ãã¢ããããããã
ã¾ãããã®è©±é¡ã¯é常ã«é·ããªãã®ã§å¥ã®æ©ä¼ã«è§¦ãããã¨æãã¾ãã
ãããã«
ããã¾ã§7åã«ãããããããç¹éããæ稿ããã¦ããã ãã¾ãããããããã§ããã§ããããï¼
åºæ¬çãªé¨åã¯ãä¼ããã¦ããã¤ããã§ãã
ãããæ²è¼å 容ã«ã¤ãã¦ã®ãææçããã¾ããããã³ã¡ã³ãããé¡ããã¾ãã
ããã¾ã§ãããããç¹éãã¯ã ããã3é±éãµã¤ã¯ã«ã§æ稿ãã¦ãã¾ããããä»å¾ã¯ä¸å®æã¨ããã¦ããã ãã¾ãã
Â
ããããèªç±æ°ã¾ã¾ãªæ¥è¨
ãããç¹éã»ã½ããã¦ã§ã¢ã«é¢ããä»ã®è¨äºãã覧ããã ãã«ã¯ä¸è¨ãã¯ãªãã¯ãã¦ãã ããã
Â