文档中提到了一种叫做代码的可执行文件,但我不确定在哪里可以找到它,所以我可以把它放在我的路径上。我从VSCode网站下载的zip文件不包括任何这样的可执行文件。(我可以很好地运行.app。)
这是windows独有的功能吗?
文档中提到了一种叫做代码的可执行文件,但我不确定在哪里可以找到它,所以我可以把它放在我的路径上。我从VSCode网站下载的zip文件不包括任何这样的可执行文件。(我可以很好地运行.app。)
这是windows独有的功能吗?
当前回答
如果你使用snap安装VS CODE。您需要在PATH环境变量中添加/snap/bin。 打开。bashrc或。zshrc 并在PATH环境变量中添加/snap/bin
重新加载终端, 代码命令将启动它
其他回答
在OSX Mavericks上,我在~/bin中创建了一个名为vscode的bash脚本(改编自vscode Setup中的.bashrc):
#!/bin/bash
if [[ $# = 0 ]]
then
open -a "Visual Studio Code"
else
[[ $1 = /* ]] && F="$1" || F="$PWD/${1#./}"
open -a "Visual Studio Code" --args "$F"
fi
Vscode <文件或目录>现在按预期工作。
从Visual Studio代码设置页面:
Tip: If you want to run VS Code from the terminal by simply typing 'code', VS Code has a command, Shell Command: Install 'code' command in PATH, to add 'code' to your $PATH variable list. After installation, launch VS Code. Now open the Command Palette (F1 or ⇧+⌘+P on Mac) and type shell command to find the Shell Command: Install 'code' command in PATH command. After executing the command, restart the terminal for the new $PATH value to take effect. You'll be able to simply type 'code .' in any folder to start editing files in that folder.
试试这个
打开Visual Studio Code,按Command + Shift + P,然后在命令面板中输入Shell,现在你可以找到这个选项,比如Shell命令:从命令面板中的建议列表中安装代码。选择该选项。
通过终端/命令提示打开VSCode
就是这样。
现在打开终端类型。
$ code。
在VS Code命令行中给出的启动路径的指令是不正确的;示例中显示的前导冒号不起作用。但是,以反斜杠结束的目录名启动将按预期打开指定的目录。
举个例子,
代码C:\Users\DAVE\Documents\编程\角\ StringCalculator \ src \
在C:\Users\DAVE\Documents\Programming\Angular\StringCalculator\src目录下打开Visual Studio代码编辑器。
重要提示:终端反斜杠虽然是可选的,但很有用,因为它清楚地表明意图是打开一个目录,而不是打开一个文件。请记住,文件扩展名一直都是可选的。
注意:附加到PATH列表的目录是\bin目录,shell命令代码启动Windows NT command脚本。
因此,当合并到另一个shell脚本中时,如果您希望运行脚本的其余部分,则必须调用或启动代码。值得庆幸的是,在我第一次测试一个新的shell脚本之前,我发现了这一点。我创建这个脚本是为了在本地Web服务器、默认的Web浏览器和Visual Studio Code中同时启动一个Angular 2项目。
下面是我的Angular启动脚本,经过调整,消除了对某个发布在其他地方的系统实用程序的依赖,但不是严格要求的。
@echo off
goto SKIPREM
=========================================================================
Name: StartAngularApp.CMD
Synopsis: Start the Angular 2 application installed in a specified
directory.
Arguments: %1 = OPTIONAL: Name of directory in which to application
is installed
Remarks: If no argument is specified, the application must be in
the current working directory.
This is a completely generalized Windows NT command
script (shell script) that uses the NPM Angular CLI to
load an Angular 2 application into a Node development
Web server, the default Web browser, and the Visual
Studio Code text editor.
Dependencies: Unless otherwise specified in the command line, the
application is created in the current working directory.
All of the following shell scripts and programs must be
installed in a directory that is on the Windows PATH
directory list.
1) ShowTime.CMD
2) WWPause.exe
3) WWSleep.exe
4) npm (the Node Package Manager) and its startup
script, npm.cmd, must be accessible via the Windows
PATH environment string. By default, this goes into
directory C:\Program Files\nodejs.
5) The Angular 2 startup script, ng.cmd, and the Node
Modules library must be installed for global access.
By default, these go into directory %AppData%\npm.
Author: David A. Gray
Created: Monday, 23 April 2017
-----------------------------------------------------------------------
Revision History
-----------------------------------------------------------------------
Date By Synopsis
---------- --- --------------------------------------------------------
2017/04/23 DAG Script created, tested, and deployed.
=======================================================================
:斯基普雷姆
echo BOJ %~0, version %~t0
echo.
echo -------------------------------------------------------
echo Displaying the current node.js version:
echo -------------------------------------------------------
echo.
node -v
echo.
echo -------------------------------------------------------
echo Displaying the current Node Package Manager version:
echo -------------------------------------------------------
echo.
call npm -v
echo.
echo -------------------------------------------------------
echo Loading Angular starter application %1
echo into a local Web server, the default Web browser, and
echo the Visual Studio Code text editor.
echo -------------------------------------------------------
echo.
if "%1" neq "" (
echo.
echo -------------------------------------------------------
echo Starting the Angular application in directory %1
echo -------------------------------------------------------
echo.
cd "%~1"
call code %1\src\
) else (
echo.
echo -------------------------------------------------------
echo Starting the Angular application in directory %CD%
echo -------------------------------------------------------
echo.
call code %CD%\src\
)
call ng serve --open
echo.
echo -------------------------------------------------------
echo %~nx0 Done!
echo -------------------------------------------------------
echo.
Pause
我有这个问题是因为VS Code内部人员。 路径变量在那里,但我需要重命名代码内部人员。CMD里面的代码。cmd。
也许这对某些人有用。