说明
说一下为啥要搞这个,第一是花里胡哨,凑个博文;第二是powershell有些linux命令还是不能用的,至少没有Git Bash支持的多,而且powershell是cmd和bash混合,不够纯粹,初学者学习起来难免容易混。
准备
首先windows上要装Git Bash
怎么做
- 找到bash命令所在的位置 我的是 D:\Git\bin\bash.exe
- vscode中设置中搜索 terminal.integrated.profiles.windows
- 编辑settings.json
在 "terminal.integrated.profiles.windows": {
行下新建一个Bash对象,或者其它什么名字都行,path中填bash命令所在的路径
"terminal.integrated.profiles.windows": {
"Bash": {
"path": [
"D:\\Git\\bin\\bash.exe"
],
"args": [],
"icon": "terminal-bash"
},
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell"
},
"Command Prompt": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"args": [],
"icon": "terminal-cmd"
},
"Git Bash": {
"source": "Git Bash"
}
},
...
- 搞定收工
现在就可以安心使用linux上的命令了