Skip to content

Instantly share code, notes, and snippets.

@greatwolf
Last active February 28, 2017 04:28
Show Gist options
  • Save greatwolf/7cf1a11bd8d358b2c5c0f852d43063bb to your computer and use it in GitHub Desktop.
Save greatwolf/7cf1a11bd8d358b2c5c0f852d43063bb to your computer and use it in GitHub Desktop.
Modified batch for extracting Visual Build Tools 2017 into standalone
@echo off& setlocal& set x86=& set w32=system32
rem http://paulhoule.com/msvc14/copymsvc14.bat May 28, 2016
if "%~1"=="" echo Copies minimal files to run CL 14.0 (32 and 64 bit)
if "%~1"=="" echo First arg must be target directory& goto :eof
if exist "c:\Program Files (x86)\." set "x86= (x86)"& set w32=syswow64
rem set vs1=c:\Program Files%x86%\Microsoft Visual Studio 14.0
set vs1=c:\Program Files%x86%\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.10.24930
set vs2=c:\Program Files%x86%\Windows Kits\10
set vs3=c:\Program Files%x86%\Windows Kits\8.1
set emsg=Can't find src dir - run on system where compiler is installed
if exist "%vs1%" if exist "%vs3%" set emsg=
if not "%emsg%"=="" echo %emsg%& goto :eof
if exist "%~1" echo dir "%~1" exists... delete it first& goto :eof
echo Copying binaries (bin, sdk\bin)..........
xcopy /i "%vs1%\bin\HostX86\x86" "%~1\bin\HostX86\x86"
xcopy /i "%vs1%\bin\HostX86\x86\1033" "%~1\bin\HostX86\x86\1033"
xcopy /i "%vs3%\bin\x86" "%~1\sdk\bin"
xcopy /i "%vs3%\bin\x86\1033" "%~1\sdk\bin\1033"
xcopy c:\windows\%w32%\api-ms-win-*.dll "%~1\bin"
xcopy c:\windows\%w32%\*140*.dll "%~1\bin"
xcopy c:\windows\%w32%\ucrtbase*.dll "%~1\bin"
xcopy c:\windows\%w32%\VsGraphicsHelper.dll "%~1\bin"
echo Copying includes (include, sdk\include)..........
xcopy /i "%vs1%\include" "%~1\include" /s
xcopy /i "%vs2%\include\10.0.10240.0\ucrt" "%~1\include" /s
xcopy /i "%vs3%\include\shared" "%~1\sdk\include" /s
xcopy /i "%vs3%\include\um" "%~1\sdk\include" /s
echo Copying libraries (lib, sdk\lib)..........
xcopy /i "%vs1%\lib\x86" "%~1\lib"
xcopy /i "%vs2%\lib\10.0.10240.0\ucrt\x86" "%~1\lib"
xcopy /i "%vs3%\lib\winv6.3\um\x86" "%~1\sdk\lib"
@greatwolf
Copy link
Author

rem vcvars32_shell.cmd
cmd /K "set PATH=%~dp0bin\HostX86\x86;%~dp0sdk\bin;%PATH%; && set INCLUDE=%~dp0include;%~dp0sdk\include; && set LIB=%~dp0lib;%~dp0sdk\lib;"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment