Advertisement
ohusq

Load CL.exe for Visual Studio Code

May 6th, 2024
1,314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Winbatch 0.90 KB | Source Code | 0 0
  1. @echo off
  2. setlocal
  3.  
  4. :: Path to the Visual Studio vcvars64.bat
  5. set "VCVARS64_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
  6.  
  7. :: Check if the VC vars batch file exists
  8. if not exist "%VCVARS64_PATH%" (
  9.     echo Error: Visual Studio 2022 Build Tools vcvars64.bat not found.
  10.     exit /b 1
  11. )
  12.  
  13. :: Initialize Visual Studio Build Tools environment
  14. call "%VCVARS64_PATH%" >nul 2>&1
  15.  
  16. :: Prompt user to enter the code folder path
  17. echo Please enter the full path to your code folder:
  18. set /p CODEFOLDER="Path: "
  19. set "CONCAT=%USERPROFILE%\Visual Studio Code\"
  20. :: Check if the directory exists
  21. if not exist "%CONCAT%%CODEFOLDER%" (
  22.     echo Error: The specified folder does not exist.
  23.     exit /b 1
  24. )
  25.  
  26. :: Change to the specified directory
  27.  
  28. cd /d "%CONCAT%%CODEFOLDER%"
  29.  
  30. :: Open Visual Studio Code in the directory
  31. code .
  32.  
  33. :: End of script
  34. endlocal
Tags: Script batch bat
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement