文档中提到了一种叫做代码的可执行文件,但我不确定在哪里可以找到它,所以我可以把它放在我的路径上。我从VSCode网站下载的zip文件不包括任何这样的可执行文件。(我可以很好地运行.app。)

这是windows独有的功能吗?


当前回答

链接你当前的文件夹到vscode。

Windows Registry Editor Version 5.00

; Directory\Background\shell => on empty space

[HKEY_CLASSES_ROOT\Directory\Background\shell\vscode]
"Icon"="C:\\current-folder-vscode\\Code.exe,0"
@="VsCode"

[HKEY_CLASSES_ROOT\Directory\Background\shell\vscode\command]
@="C:\\current-folder-vscode\\Code.exe ."

; Directory\shell => on a folder

[HKEY_CLASSES_ROOT\Directory\shell\vscode]
@="VsCode"
"Icon"="C:\\current-folder-vscode\\Code.exe,0"

[HKEY_CLASSES_ROOT\Directory\shell\vscode\command]
@="C:\\current-folder-vscode\\Code.exe ."

其他回答

你可以使用Visual Studio Code定义的vscode:协议:

open vscode://file/full/path/to/project/or/file

你也可以使用

/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code

如果你不想修改你的路径

如果你正在使用可视代码内部,并且你想从你的终端或任何其他命令行工具在visual Studio code内部打开一个文件或文件夹,那么你可以参考下面的命令,这些命令在visual Studio code内部默认出现。

从命令行打开Visual Studio Code

code-insiders——

打开整个文件夹/目录

code-insiders。

打开特定的文件

code-insiders file_name

例:- code index.html

我把这个添加到我的~/.profile中

alias vscode='/Applications/Visual\ Studio\ Code.app/Contents/MacOS/Electron'

then

. ~/.profile

之后我就可以做了

 vscode

从终点站

对于Windows,您可以使用命令:

start Code filename.extension

上面这句话对我很适用。

注意:仅适用于Windows用户。

正如许多人已经建议从命令提示符使用代码打开代码的方法一样。命令。这将只打开Visual Studio Code Stable构建。但是如果你已经下载了Visual Studio Code Insider版本/版本(它有所有最新的版本/功能,但不稳定的版本),那么你需要在windows中遵循以下说明:

进入控制面板\系统和安全\系统。单击高级系统设置 点击环境变量 在系统变量选项卡下,单击路径变量的编辑 新增路径C:\Users\tsabu\AppData\Local\Programs\Microsoft VS Code Insiders\bin (或) C:\Program Files\Microsoft VS Code Insiders\bin基于你在机器中安装vscode insider的位置。 打开一个新的命令提示符并输入code-insiders。打开vcode -insider 建立/版本