参考内容
参考:https://blog.csdn.net/u010175701/article/details/78883126
参考:https://www.jianshu.com/p/269b58ff77cb
参考:code.cmd 和 code 脚步
windows系统的cmd命令添加vscode命令(或者其它名称命令)
- windows cmd窗口命令 再code的bin目录下,新建vscode.cmd文件(vscode就是命令名)
- 其实就是备份了code.cmd 的内容,然后追加
--extensions-dir %~dp0..\extensions 参数
@echo off
setlocal
set VSCODE_DEV=
set ELECTRON_RUN_AS_NODE=1
cd %~dp0
call "%~dp0..\Code.exe" "%~dp0..\resources\app\out\cli.js" --extensions-dir %~dp0..\extensions %*
endlocal
- gitbash或者powerShell命令行,再code的bin目录下,新建vscode(vscode就是命令名)
- 其实就是复制了下code文件的内容,追加
- 其实就是复制了下code文件的内容,追加
XTENSIONS_HOME="$VSCODE_PATH/extensions"
--extensions-dir="$EXTENSIONS_HOME"
文件中的代码如下:
#!/usr/bin/env bash
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
NAME="Code"
VSCODE_PATH="$(dirname "$(dirname "$(realpath "$0")")")"
ELECTRON="$VSCODE_PATH/$NAME.exe"
EXTENSIONS_HOME="$VSCODE_PATH/extensions"
if grep -q Microsoft /proc/version; then
if [ -x /bin/wslpath ]; then
# On recent WSL builds, we just need to set WSLENV so that
# ELECTRON_RUN_AS_NODE is visible to the win32 process
export WSLENV=ELECTRON_RUN_AS_NODE/w:$WSLENV
CLI=$(wslpath -m "$VSCODE_PATH/resources/app/out/cli.js")
else
# If running under older WSL, don't pass cli.js to Electron as
# environment vars cannot be transferred from WSL to Windows
# See: https://github.com/Microsoft/BashOnWindows/issues/1363
# https://github.com/Microsoft/BashOnWindows/issues/1494
"$ELECTRON" "$@"
exit $?
fi
elif [ "$(expr substr $(uname -s) 1 9)" == "CYGWIN_NT" ]; then
CLI=$(cygpath -m "$VSCODE_PATH/resources/app/out/cli.js")
else
CLI="$VSCODE_PATH/resources/app/out/cli.js"
fi
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" --extensions-dir="$EXTENSIONS_HOME" "$@"
exit $?











网友评论