setup-win-for-dev.bat 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. REM Parameters vs_buildtools.exe download link and wsdk version
  2. @ECHO OFF
  3. SET buildtools_link=https://download.visualstudio.microsoft.com/download/pr/d7691cc1-82e6-434f-8e9f-a612f85b4b76/c62179f8cbbb58d4af22c21e8d4e122165f21615f529c94fad5cc7e012f1ef08/vs_BuildTools.exe
  4. SET wsdk10_link=https://go.microsoft.com/fwlink/p/?LinkId=845298
  5. SET wsdk=10SDK.18362
  6. REM Check for disk space
  7. Rem 543210987654321
  8. Set "Blank= "
  9. Set "GB100= 107374182400"
  10. for /f "tokens=2" %%A in (
  11. 'wmic LogicalDisk Get DeviceID^,FreeSpace ^| find /i "C:"'
  12. ) Do Set "FreeSpace=%Blank%%%A"
  13. Set "FreeSpace=%FreeSpace:~-15%"
  14. Echo FreeSpace="%FreeSpace%"
  15. Echo 100 GB="%GB100%"
  16. If "%FreeSpace%" gtr "%GB100%" (
  17. Echo yes enough free space
  18. ) else (
  19. Echo not enough free space - 100GB
  20. exit 5
  21. )
  22. REM Interpret arguments
  23. :loop
  24. IF NOT "%1"=="" (
  25. IF "%1"=="-buildtools_link" (
  26. SET buildtools_link=%2
  27. SHIFT
  28. )
  29. IF "%1"=="-wsdk" (
  30. SET wsdk=%2
  31. SHIFT
  32. )
  33. SHIFT
  34. GOTO :loop
  35. )
  36. @ECHO ON
  37. if not exist "C:\TEMP\" mkdir C:\TEMP
  38. REM Download vs_buildtools.exe to C:\TEMP\vs_buildtools.exe
  39. powershell -command "& { iwr %buildtools_link% -OutFile C:\TEMP\vs_buildtools.exe }"
  40. REM Install Visual Studio Toolchain
  41. C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache ^
  42. --installPath "%ProgramFiles(x86)%/Microsoft Visual Studio/2019/Community" ^
  43. --add Microsoft.VisualStudio.Workload.VCTools ^
  44. --add Microsoft.VisualStudio.Component.VC.140 ^
  45. --add Microsoft.VisualStudio.Component.VC.ATLMFC ^
  46. --add Microsoft.VisualStudio.Component.VC.Tools.ARM64 ^
  47. --add Microsoft.VisualStudio.Component.VC.MFC.ARM64 ^
  48. --add Microsoft.VisualStudio.Component.Windows%wsdk% ^
  49. --includeRecommended
  50. REM Install Windows SDK
  51. powershell -command "& { iwr %wsdk10_link% -OutFile C:\TEMP\wsdk10.exe }"
  52. C:\TEMP\wsdk10.exe /features /quiet
  53. REM Install chocolatey to further install dependencies
  54. set chocolateyUseWindowsCompression='true'
  55. @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" ^
  56. -NoProfile -InputFormat None -ExecutionPolicy Bypass ^
  57. -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
  58. SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
  59. REM Install nodejs python git and yarn needed dependencies
  60. choco install -y nodejs python2 git yarn windows-sdk-10-version-1903-windbg
  61. call C:\ProgramData\chocolatey\bin\RefreshEnv.cmd
  62. SET PATH=C:\Python27\;C:\Python27\Scripts;%PATH%
  63. pip install pywin32
  64. call C:\ProgramData\chocolatey\bin\RefreshEnv.cmd
  65. pip2 install pywin32
  66. REM Setup Depot Tools
  67. git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git C:\depot_tools
  68. SET PATH=%PATH%;C:\depot_tools\