Last active
October 9, 2022 04:43
-
-
Save SummonHIM/cd99bd4f2c40d1664dd7ea72b13fa574 to your computer and use it in GitHub Desktop.
Start VSCode with VSBuild Tool / 配置带有 VS 生成工具的 VSCode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @echo off | |
| if exist "%appdata%\CCode\settings.bat" ( | |
| call "%appdata%\CCode\settings.bat" | |
| ) else ( | |
| mkdir "%appdata%\CCode" | |
| echo set vcVarArch=x64 >"%appdata%\CCode\settings.bat" | |
| call "%appdata%\CCode\settings.bat" | |
| ) | |
| for /f "tokens=2 delims==" %%a in ('wmic os get OSLanguage /Value ^| find "OSLanguage"') do set OSLanguage=%%a | |
| if %OSLanguage% == 2052 ( | |
| set langTitle=Visual Studio Code ^(C/C++ 语言环境^) | |
| set langVSCodePath=未给 Visual Studio Code 配置 Path 环境。请正确配置环境后重试。 | |
| set langBuildAuxPath=请将脚本移至 “[Visual Studio 安装位置]\[版本年号]\BuildTools\VC\Auxiliary\Build” 文件夹运行。您可配置快捷方式到桌面。 | |
| set langStartCode=正在启动 Visual Studio Code… | |
| set langStartCodeWithArgs=正在启动 Visual Studio Code,参数为 "%*"… | |
| set langExit=按任意键退出… | |
| ) else ( | |
| set langTitle=Visual Studio Code ^(C/C++ Environment^) | |
| set langVSCodePath=You need to set Visual Studio Code path to system path. | |
| set langBuildAuxPath=Please copy this script to "[Visual Studio Install Path]\[Version Code Year]\BuildTools\VC\Auxiliary\Build". | |
| set langStartCode=Starting Visual Studio Code... | |
| set langStartCodeWithArgs=Starting Visual Studio Code with arguments "%*"... | |
| set langExit=Press any key to exit... | |
| ) | |
| title %langTitle% | |
| where code>nul | |
| if %errorlevel% neq 0 ( | |
| echo %langVSCodePath% | |
| echo %langExit% | |
| pause>nul | |
| exit | |
| ) | |
| if not exist "%~dp0vcvarsall.bat" ( | |
| echo %langBuildAuxPath% | |
| echo %langExit% | |
| pause>nul | |
| exit | |
| ) | |
| call "%~dp0vcvarsall.bat" %vcVarArch% | |
| echo, | |
| if "%*" == "" ( | |
| echo %langStartCode% | |
| ) else ( | |
| echo %langStartCodeWithArgs% | |
| ) | |
| code %* | |
| exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment