[英]add a shortcut in Windows Git Bash (MinGW) for Visual Studio Code
I am looking for a way to add shortcuts in Windows Git Bash (MinGW). 我正在寻找一种在Windows Git Bash(MinGW)中添加快捷方式的方法。
$ code . // should open code in current location
The Visual Studio Code setup page shows how to setup shortcuts in Mac OS X / Linux. Visual Studio代码设置页面显示了如何在Mac OS X / Linux中设置快捷方式。
I just need a way to setup a basic shortcut so when I type 我只需要一种设置基本快捷方式的方法,所以当我键入
code c:\
it will execute: 它将执行:
"c:\\Program Files (x86)\\Microsoft VS Code\\bin\\code.cmd" c:\\ “ c:\\ Program Files(x86)\\ Microsoft VS Code \\ bin \\ code.cmd” c:\\
I got it to work using node: 我让它使用节点工作:
node /c/Program\ Files\ \(x86\)/Microsoft\ VS\ Code/bin/code.js .
Now I just need to make this into a shortcut. 现在,我只需要把它变成一个快捷方式。
I think this could be accomplished using a symlink. 我认为可以使用符号链接来实现。 I'm just not sure how to add an extra variable in there ie 我只是不确定如何在其中添加额外的变量,即
ln -s "node /c/path/to/code.js" code
Doing something like the above fails since adding a string is not recognized as valid path. 由于添加字符串未被识别为有效路径,因此执行上述操作失败。
solution 解
to expand on zoon's answer the following worked for me 扩展zoon的答案,以下对我有用
#! /bin/sh node /c/Program\\ Files\\ \\(x86\\)/Microsoft\\ VS\\ Code/bin/code.js $*
add a symlink to that code.cmd 将符号链接添加到该code.cmd
ln /c/path/to/file/code.cmd code ln /c/path/to/file/code.cmd代码
this allows me to pass path parameter to code 这使我可以将path参数传递给代码
code ./somefolder/
Create a shell script: 创建一个shell脚本:
#! /bin/sh
cmd //C code.cmd $*
name it 'code' and put it with 'code.cmd'. 将其命名为“ code”,并以“ code.cmd”命名。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.