VS Code指定扩展安装位置
默认情况下,(Windows)vscode的安装路径为C:\Users\用户名\.vscode\extensions
。
如果想要自定义扩展的安装路径,无法直接在vscode中修改。但是,在启动vscode的时候,可以指定扩展路径。
D:\Software\Microsoft VS Code\bin>code --help
Visual Studio Code 1.68.1
Usage: code.exe [options][paths...]
To read output from another program, append '-' (e.g. 'echo Hello World | code.exe -')
...
Extensions Management
--extensions-dir <dir> Set the root path for extensions.
--list-extensions List the installed extensions.
可以看到,code有个选项--extensions-dir
,它用来指定扩展安装位置。
更改步骤:
- 新建安装扩展包的文件夹,比如
D:\Software\Microsoft VS Code\extensions
- 右击打开桌面的VS Code快捷图标,点击属性
- 在
目标
位置加入扩展包安装路径
"D:\Software\Microsoft VS Code\Code.exe" --extensions-dir "D:\Software\Microsoft VS Code\extensions"
- 点击
确定
按钮,之后,再次双击桌面的快捷图标打开VS Code,进行扩展包安装,安装的位置就是我们自定义设置的位置了