这个问题说明了一切。

如何打开VS Code编辑器

windows cmd Linux和MAC终端

例如,为记事本++我写

>开始记分卡+测试。txt

顺便说一下,编辑器很棒(跨平台)!谢谢你,纳德拉!

你可以从微软下载


当前回答

在Windows上安装时,系统会提示您将VS Code添加到PATH中。

我试图弄清楚如何从命令行用VS Code打开文件,我已经有了这个能力-我只是忘了我已经添加了它。您可能已经安装了它-通过导航到要打开的文件夹并运行命令代码进行检查。打开该文件夹。

其他回答

要打开一个文件或目录,使用以下命令:

code /path/to/file/or/directory/you/want/to/open

对于macOS用户,需要手动安装:

启动VS代码。 Command + Shift + P打开命令面板。 输入shell命令,找到shell命令:在PATH中安装'code'命令,并选择安装它。 重新启动终端。

一种简单的方法是转到你想要打开它并键入的项目

代码。cmd D: \ PathTo \ \ MyProject的志愿者项目

就是这样。它将在Visual Studio Code中打开您的项目。

根据文档:

Mac OS X Download Visual Studio Code for Mac OS X. Double-click on VSCode-osx.zip to expand the contents. Drag Visual Studio Code.app to the Applications folder, making it available in the Launchpad. Add VS Code to your Dock by right-clicking on the icon and choosing Options, Keep in Dock. Tip: If you want to run VS Code from the terminal, append the following to your ~/.bash_profile file (~/.zshrc in case you use zsh). code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* ;} Now, you can simply type code . in any folder to start editing files in that folder. Tip: You can also add it to VS Code Insiders build by changing "com.microsoft.VSCodeInsiders". Also if you don't to type the whole word code, just change it to c. Linux Download Visual Studio Code for Linux. Make a new folder and extract VSCode-linux-x64.zip inside that folder. Double click on Code to run Visual Studio Code. Tip: If you want to run VS Code from the terminal, create the following link substituting /path/to/vscode/Code with the absolute path to the Code executable sudo ln -s /path/to/vscode/Code /usr/local/bin/code Now, you can simply type code . in any folder to start editing files in that folder.

对于VS Code内部的Windows用户(VS Code doc):

添加目录“C:\Program Files (x86)\Microsoft VS Code Insiders\bin” %PATH%环境变量。

然后进入你想用vs code打开的文件夹,输入: code-insders。

在Ubuntu上,flatpak版本似乎坏了。我卸载了它,并从微软下载了deb包。