ð° 1. ã¯ããã«
Windows ã䜿ã£ãŠããæ¹ãžè³ªåã§ãïŒ
ãQ. ï¿€ ãšã¯ã¹ãããŒã©ãŒð ãéããªãæ¥ã¯ãããŸããïŒ
ããããæ®ã©ã®äººã¯ïŒæ¯æ¥ã®ããã« ãšã¯ã¹ãããŒã©ãŒ ã®ãäžè©±ã«ãªã£ãŠããããšã§ãããïŒ
ãããŠïŒã¢ãã¬ã¹ããŒã« cmd
ãšå
¥ããããšã§ïŒããŸéããŠããå Žæãã«ã¬ã³ããã£ã¬ã¯ããªãšã㊠ã³ãã³ãããã³ãã ãèµ·åã§ãã1 ããšãïŒç¥ã£ãŠãã人ã¯å€ããããããŸããïŒ
ããæ¥ïŒç§ã¯æããŸããïŒã䌌ããããªããšã VSCode ã§ãããããïŒã
ðïž 2. ãã®èšäºã®å 容
ãã®èšäºã§ã¯ïŒããšã¯ã¹ãããŒã©ãŒã®ã¢ãã¬ã¹ããŒã« vsc
ãšå
¥åããããšã§ïŒããŸéããŠããå Žæã VSCode ã§èµ·åã§ããããã«ããæ¹æ³ãã説æããŸãïŒ
å®æäŸ
ïŒèæ¯ãäžç¬æ転ããã®ã¯ïŒè£ã§ã³ãã³ãããã³ãããéãããã§ãïŒããã«æ¶ããŸãïŒïŒ
âš 3. æé
ããããïŒå ·äœçãªæé ã説æããŠãããŸãïŒ
泚æ
C:\Windows\
ã«æãå ããŸãïŒæäœã誀ããšã·ã¹ãã ãã¡ã€ã«ã«åœ±é¿ãåãŒãããç¥ããŸããïŒèªå·±è²¬ä»»ã§é²ããŠãã ããïŒ
â â ããããã¡ã€ã«ãæžã
ä»»æã®å Žæã«ïŒä»¥äžã®å
容㮠vsc.bat
ãã¡ã€ã«ãæžããŸãïŒ
ããã§ã¯ïŒC:\Tools\
ã®äžã«çœ®ãããšã«ããŸãïŒ
@echo off
code %cd%
-
@echo off
ã§ïŒèŠãããã®ããã«ã³ãã³ãã®å®è¡ãã°ãé衚瀺ã«ããŠããŸã -
%cd%
ã§ïŒã«ã¬ã³ããã£ã¬ã¯ããªãèªã¿åãïŒãããcode
ã³ãã³ãã«æž¡ããŠããŸã
ïŒã³ãŒãã®æŽãªã詳现ã«ã€ããŠã¯ïŒæ¬¡ç« ã4. ã©ãããŠ/ã©ã®ããã«åããŠããã®ããããèªã¿ãã ããïŒïŒ
â â¡ ã·ã³ããªãã¯ãªã³ã¯ãäœæãã
管çè
æš©é㧠ã³ãã³ãããã³ãã ãéããŠïŒä»¥äžãæã¡èŸŒã㧠Enter ããŠãã ããïŒ
ããã¯ïŒvsc.bat
ã C:\Tools\vsc.bat
ã«ããå Žåã®äŸã§ãïŒ
mklink C:\Windows\vsc.bat C:\Tools\vsc.bat
-
mklink
ã³ãã³ãã§ïŒããŸäœã£ãããããã¡ã€ã«vsc.bat
ã®ã·ã³ããªãã¯ãªã³ã¯ãC:\Windows\
ãã©ã«ãã«äœæããŸã -
C:\Windows\
㯠Windows ã®ç°å¢å€æ° PATH ã«ããã©ã«ãã§å«ãŸããŠããããïŒvsc
ãšæã€ã ãã§ïŒã©ãããã§ã ãã®ããããã¡ã€ã«ãå®è¡ã§ããŸã
ãã©ãã«ã·ã¥ãŒãã£ã³ã°
ã¢ã¯ã»ã¹ãæåŠãããŸãã
çãšè¡šç€ºãããå Žåã¯ïŒç®¡çè
æš©éã§å®è¡ã§ããŠããªãå¯èœæ§ããããŸãïŒã³ãã³ãããã³ããã®ã¢ã€ã³ã³ãå³ã¯ãªãã¯ããŠã管çè
ãšããŠå®è¡ããã¯ãªãã¯ããŠïŒã³ãã³ãããã³ãããéããŠãã ããïŒ
ããã«ãŠå®æã§ãïŒ
å®æäŸ åæ§ã®æåã瀺ãã確èªããŠã¿ãŠãã ããïŒ
以éã§ã¯ïŒäžèšæé 㮠詳现ã解説ããŠãããŸãïŒèå³ã®ããæ¹ã¯ ãã²èªãã§ã¿ãŠãã ããïŒ
泚æ
å°æ¥çã« vsc
ãšããååã®ããã°ã©ã ãè¿œå ãããéã«ïŒç«¶åãããããããŸããïŒãã®å Žåã«ã¯ä»åã®ã·ã³ããªãã¯ãªã³ã¯ãåé€ãããªã©ïŒå¯Ÿå¿ããŠãã ããïŒ
del C:\Windows\vsc.bat
ð 4. ã©ãããŠ/ã©ã®ããã«åããŠããã®ã
ãã£ã2ã¹ãããã§ïŒä»åã®å 容ãå®è£ ã§ããŸããïŒãã®ç°¡ææ§ã®è£ã«ã¯ïŒã©ã®ãã㪠æœè±¡å ãé ããŠããã®ã§ããããïŒããããã¯ïŒãããæ·±å ã£ãŠããããšæããŸãïŒðâïž
ãããã ããããã¡ã€ã« ãšã¯äœè ãïŒ
ä»åã¯ïŒvsc.bat
ãšããããããã¡ã€ã«ãäœãïŒãããã³ãã³ãããã³ããããåŒã³åºããŸããïŒããã§ã¯ãããããã¡ã€ã«ãšã¯äœãªã®ããïŒãããŠãã³ãã³ãã©ã€ã³ããåŒã³åºããå®è¡ãã¡ã€ã«ãšã¯äœãªã®ãããèŠãŠãããŸãïŒ
ããããã¡ã€ã«ïŒBAT/Batch fileïŒãšã¯
-
Windows ç°å¢ïŒã³ãã³ãããã³ããçïŒã§å®è¡ã§ããã³ãã³ããèšè¿°ããããã¹ããã¡ã€ã«ïŒ
.bat
ãããã¯.cmd
ïŒã§ã 23 - ã€ãŸãïŒäžåºŠããããã¡ã€ã«ãäœæããŠããã°ïŒã²ãšãããŸãã®ã³ãã³ãã楜ã«å®è¡ã§ããããã§ãâš
- ããããã¡ã€ã«ã®è©³ããæžãæ¹ã«ã€ããŠã¯ïŒããããã¡ã€ã«ã®åºæ¬çãªæžåŒãšèãæ¹ - Qiita ãåèã«ãªããŸã
- ããã«èå³ã®ããæ¹ã¯ïŒMicrosoft ã®å ¬åŒããã¥ã¡ã³ã Windows Commands - Windows Server documentation ã«ç®ãéããŠã¿ãã®ãè¯ãããç¥ããŸãã
ã³ãã³ãã©ã€ã³ããåŒã³åºããå®è¡ãã¡ã€ã«ã«ã€ããŠ
- ããããã¡ã€ã«ã¯ Windows ã®ã³ãã³ããæžãããã¹ã¯ãªããã§ïŒããã«ã¯ãªãã¯ã§å®è¡ã§ããŸã
- ãã ãïŒWindows ã®ç°å¢å€æ°
PATH
ã«ãã¹ãéã£ãŠãã å ŽåïŒããã«å ã ã³ãã³ãã©ã€ã³ãããã¡ã€ã«åã ãã§çŽæ¥å®è¡ã§ãã ã®ã§ã- ãæ¡åŒµåãçç¥ããŠãåŒã³åºããçç±ã¯ïŒç°å¢å€æ°
PATHEXT
ã«ç»é²ãããæ¡åŒµåãèªåã§æ¢ããïŒæåã«èŠã€ãã£ããã®ãå®è¡ãããããã«ãªã£ãŠããããã§ã - ç°å¢å€æ°
PATHEXT
ã«ã€ããŠã¯ïŒãããããâãã¹ãéãâãšã¯ã©ãããããšãããå«ã㊠ãPATH ãéããã®æå³ãã§ããã ããããããã説æããè©Šã¿ - Qiita ã«è©³ããèŒã£ãŠããŸã
- ãæ¡åŒµåãçç¥ããŠãåŒã³åºããçç±ã¯ïŒç°å¢å€æ°
- ãããã£ãŠïŒ
PATH
ãéã£ãŠããC:\Windows\
ã«vsc.bat
ïŒã®ã·ã³ããªãã¯ãªã³ã¯ïŒã眮ãããšã§ïŒæ¡åŒµåãçç¥ãããã¡ã€ã«åvsc
ã ãã§ã³ãã³ããåŒã³åºããããã§ãã
ã·ã³ããªãã¯ãªã³ã¯ ã«ã€ããŠã¯è©³çŽ°ãã ã·ã³ããªãã¯ãªã³ã¯ ãšã¯äœãïŒãã§åŸè¿°ããŸã
ãªã ãšã¯ã¹ãããŒã©ãŒã®ã¢ãã¬ã¹ããŒããã³ãã³ããå®è¡ã§ããã®ã
- ããã¯åçŽã«ïŒããšã¯ã¹ãããŒã©ãŒã®ã¢ãã¬ã¹ããŒããã¡ã€ã«ãã¹ã ãã§ãªãïŒã³ãã³ãã®å®è¡ã«ã察å¿ããŠãã ãããã§ã
- æ£çŽïŒèª¿ã¹ãŠããããããä»æ§ã«ãªã£ãŠããããã以äžã®çç±ãèŠã€ããããŸããã§ããâŠ
- 調ã¹ããŠããäžã§èŠã€ããïŒãšã¯ã¹ãããŒã©ãŒã®ã¢ãã¬ã¹ããŒã§äœ¿ãã䟿å©æã幟ã€ãèŒããŠãããŸã
code
ã³ãã³ããšã¯ïŒ
vsc.bat
ã§ã¯ code %cd%
ãšãã£ãå
·åã«ïŒ code
ã³ãã³ãã䜿çšããŸããïŒããã¯äžäœãªãã§ããããïŒ
code
ã³ãã³ã
- VSCode ã®ã€ã³ã¹ããŒã«æã«ããã©ã«ãã§ç°å¢å€æ°
PATH
ã«è¿œå ãããã³ãã³ãã§ã- VSCode ãäžå¯§ã«ã CLI ã®ã³ãã³ãããã«ãã€ã³ããŠãããŠããããã§ãã
- ãã䜿ããããªã³ãã³ãã«ã€ããŠã¯ïŒVSCode䜿ããªãæããŠããã¹ãCodeã³ãã³ã - Zenn ã«ãŸãšãŸã£ãŠããŸã
- ãã£ãšèå³ã湧ããŠããæ¹ã¯ïŒå ¬åŒããã¥ã¡ã³ã Command Line Interface (CLI) - Visual Studio Code ãžã©ãã
ã·ã³ããªãã¯ãªã³ã¯ ãšã¯äœãïŒ
ä»åïŒC:\Tools\vsc.bat
ã® ã·ã³ããªãã¯ãªã³ã¯ ã C:\Windows\vsc.bat
ãšããŠäœæããŸããïŒã·ã³ããªãã¯ãªã³ã¯ãšã¯äœãªã®ã§ããããïŒãã·ã§ãŒãã«ããããšã¯éãã®ã§ããããïŒ
ã·ã³ããªãã¯ãªã³ã¯ïŒsymlinkïŒ
- ããå Žæã«ãããã¡ã€ã«ããã©ã«ããžã® åç §ïŒãªã³ã¯ïŒã§ã
- æ®éã®ãã·ã§ãŒãã«ããããšéãïŒOSã¬ãã«ã§ ãªã³ã¯å
ãå®éã«ãã®å Žæã«ååšãããã®ããã«æ±ãããŸã
- ã·ã§ãŒãã«ãããšã®éãã¯ïŒã·ã³ããªãã¯ãªã³ã¯ã®äœ¿ãæ¹ãšèœãšãç©Ž - Qiita ã«äžäŸãèŒã£ãŠããŸã
- ãŸãïŒã·ã³ããªãã¯ãªã³ã¯ã®å¯ŸçŸ©èªãšããŠãããŒããªã³ã¯ãããããŸã
- ã·ã³ããªãã¯ãªã³ã¯ ã¯ãã·ã³ããªãã¯ïŒè±¡åŸŽ/èšå·ïŒããšèšãã ããã£ãŠïŒãªã³ã¯å ã®ãã¡ã€ã«/ãã©ã«ããšã¯å¥ç©ã§ãïŒåé€ããŠããªã³ã¯ãåããã ãã§ïŒãªã³ã¯å ã¯æ®ããŸãïŒ
- ããŒããªã³ã¯ ã¯ïŒãªã³ã¯å ãšïŒæ®ã©ïŒåããã®ã§ããïŒããªã³ã¯å ããšããªã³ã¯å ããšããåºå¥ããææ§ã§ãïŒã©ã®ãªã³ã¯ãæžãæããŠãä»ã®ãªã³ã¯ãã¹ãŠã«å€æŽãåæ ãããŸãïŒ 6
- ããšããš Linux ãªã©ã§åºãŠããçšèªãããã§ããïŒããã§ã¯ Windows ã«ç¹åãã話ãããŠããŸã
ã·ã§ãŒãã«ããã»ã·ã³ããªãã¯ãªã³ã¯ã»ããŒããªã³ã¯ã®éã
ããããã®éããè¡šã«ãŸãšãããã®ãïŒä»¥äžã«ãªããŸãïŒ7
ã·ã§ãŒãã«ãã | ã·ã³ããªãã¯ãªã³ã¯ | ããŒããªã³ã¯ | |
---|---|---|---|
ç®ç | GUIäžã®æ軜ãªãªã³ã¯ | ãã¡ã€ã«ããã£ã¬ã¯ããªã®åç § | åããã¡ã€ã«ãžã®è€æ°ã®åç § |
å®æ ã®æç¡ | å®æ ãªã | å®äœãªã | å®äœãã |
ããŒã¿ã®å ±æ | ãªãªãžãã«ãéãã ã | ãªãªãžãã«ãšãªã³ã¯å ã¯åãå 容 | ããŒããªã³ã¯ãã¹ãŠãåãå®äœãå ±æ |
ç Žæã®å¯èœæ§ | ãªãªãžãã«ã移å/åé€ãããšç¡å¹å | ãªã³ã¯å ãåé€ããããšãªã³ã¯åã | ã©ã®ãªã³ã¯ãæ¶ããŠãããŒã¿ã¯æ®ã |
察象 | ã¢ããªã»ãã¡ã€ã«ã»ãã©ã«ã | ãã¡ã€ã«ã»ãã£ã¬ã¯ã㪠| ãã¡ã€ã«ã®ã¿ |
ç°ãªããã£ã¹ã¯ã®åç § | å¯èœ | å¯èœ | äžå¯ïŒåãããŒãã£ã·ã§ã³å ã®ã¿ïŒ |
管çè æš©é | äžèŠ | å¿ èŠ | å¿ èŠ |
ãªã ãããã C:\Tools\
ã«ããããã¡ã€ã«ã眮ãã®ãïŒ
ã·ã³ããªãã¯ãªã³ã¯ããOSãéšããâæ¬ç©ã«è¿ãâã·ã§ãŒãã«ãããã§ããã°ïŒåããã C:\Windows\
ã«ããããã¡ã€ã«ã眮ããŠã¯ãã¡ãªã®ã§ããããïŒ
çµè«ãèšãã°ïŒããã§ãåé¡ãªãåäœããŸãïŒãããïŒäž»ã«æ¬¡ã®ãããªçç±ããïŒC:\Windows\
ä»¥å€ ã®å Žæã«ããããã¡ã€ã«ã眮ãããšãæãŸããã®ã§ãïŒ
çŽæ¥ C:\Windows\
ã«ããããã¡ã€ã«ã眮ããªãçç±
-
ä¿å®ã»ç®¡çã ããããã
-
C:\Windows\
ã«ã¯ä»ã«ãã·ã¹ãã ãã¡ã€ã«ãå ããããããä¿ç®¡ãããŠããŸã - èªäœã®ããããã¡ã€ã«ãæ¯å
C:\Windows\
ããæ¢ããããïŒC:\Tools\
ã«ãŸãšããŠãã£ãæ¹ãïŒç®¡çã楜ã§ã
-
-
ã·ã¹ãã ã®å®å
šæ§ã®èŠ³ç¹
- ããŸè¿°ã¹ãããã«
C:\Windows\
ã«ã¯ã·ã¹ãã ã·ã¹ãã ãä¿ç®¡ããïŒãã®å€ã㯠OS ã«ãšã£ãŠéèŠãªãã®ã§ã - ããããã¡ã€ã«ã
C:\Windows\
ã«çŽçœ®ããããããïŒå®äœãå¥ãã©ã«ãã«éé¢ãããæ¹ãïŒã·ã¹ãã ã·ã¹ãã ã®èª€ã£ãäžæžã/åé€ãªã©ãé²ããŸã
- ããŸè¿°ã¹ãããã«
-
OS ã¢ããã®åœ±é¿åé¿
- Windows ã®ã¢ããããŒããåã€ã³ã¹ããŒã«ã«ãã£ãŠ
C:\Windows\
ã«çœ®ããããããã¡ã€ã«ãæ¶ããããšããããŸã - æ¶ããã®ãããããã¡ã€ã«æ¬äœã§ã¯ãªãã·ã³ããªãã¯ãªã³ã¯ã§ããã°ïŒåãªã³ã¯ãããã°è¯ãã ããªã®ã§ïŒè»œçã§æžã¿ãŸã
- Windows ã®ã¢ããããŒããåã€ã³ã¹ããŒã«ã«ãã£ãŠ
ãŸãïŒC:\Windows\
ã«ã·ã³ããªãã¯ãªã³ã¯ãäœæããã«ïŒC:\Tools\
ãç°å¢å€æ° PATH
ã«è¿œå ããã®ãïŒã²ãšã€ã®æã§ãïŒð
ð 5. ãããã«
æã£ãŠããããé·ããªã£ãŠããŸããŸãããïŒãããŸã§ ãèªã¿ããã ã ããããšãããããŸãïŒð
ä»åã®å 容ãèžãŸããã°ïŒæ¥åžžäœæ¥ã®å©äŸ¿æ§ãäžããäœããïŒä»ã«ãå®è£ ã§ããæ°ãããŠããŸãããïŒã©ããäœããåŠã¶ãªãïŒä»ã«å¿çšãå©ã圢ã§ïŒãªãã¹ããªãäœç³»çã«ïŒç¿åŸãããã§ãããïŒð
èªåã¯ãã®åºŠïŒåã㊠Qiita ã«èšäºãæžãïŒåã㊠ã¡ãããšããããã¡ã€ã«ã«è§ŠããŸããïŒ
ãšã³ãžãã¢ã®äžçã§ã¯ãã¢ãŠãããããããã¿ãèŠã€ããŠèšäºã«ãŸãšããããšã§ïŒïŒèª°ãã®çåã«åœ¹ç«ã€ã ãã§ãªãïŒèªåã®ã€ã³ãããã®è³ªãé«ãããããšãæ¥åžžçã«è¡ãããŠããããã«æããŸãïŒãããããã«ç¿æ £åããã®ã¯é£ãããšãïŒèªåããã®å¥œåŸªç°ã®æžŠïŒæ²ŒïŒïŒã«ãã£ãããšå ¥ã£ãŠãããããã®ã§ãïŒð±
-
ãã³ãã³ã ããã³ããããããšã¯ã¹ãããŒã©ãŒãããéãæéã®æ ïœãã£ããœã³ïŒ - çªã®æ â©
-
ããããã¡ã€ã«(BATãã¡ã€ã«)ãšã¯ïŒäœãæ¹ãæžãæ¹ãåå¿è åãã«è§£èª¬ïŒ - ITãã¬ã³ã â©
-
æ¡åŒµåã.batããšã.cmdãã®éã - ãåãããããã§ãåãããªããã§ããåãã£ããæ°ã«ãªããITçšèªèŸå ž â©
-
DATãã¡ã€ã« - ãåãããããã§ãåãããªããã§ããåãã£ããæ°ã«ãªããITçšèªèŸå ž â©
-
ãã·ã³ããªãã¯ãªã³ã¯ããšãããŒããªã³ã¯ãã®éã - ãåãããããã§ãåãããªããã§ããåãã£ããæ°ã«ãªããITçšèªèŸå ž â©
-
Windowsã®ã·ã³ããªãã¯ãªã³ã¯ãšãžã£ã³ã¯ã·ã§ã³ãšããŒããªã³ã¯ã®éã - ITmedia â©