setup-win-for-dev.bat 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. REM Parameters vs_buildtools.exe download link and wsdk version
  2. @ECHO OFF
  3. SET wsdk=11SDK.22621
  4. REM Check for disk space
  5. Rem 543210987654321
  6. Set "Blank= "
  7. Set "GB100= 107374182400"
  8. for /f "tokens=2" %%A in (
  9. 'wmic LogicalDisk Get DeviceID^,FreeSpace ^| find /i "C:"'
  10. ) Do Set "FreeSpace=%Blank%%%A"
  11. Set "FreeSpace=%FreeSpace:~-15%"
  12. Echo FreeSpace="%FreeSpace%"
  13. Echo 100 GB="%GB100%"
  14. If "%FreeSpace%" gtr "%GB100%" (
  15. Echo yes enough free space
  16. ) else (
  17. Echo not enough free space - 100GB
  18. exit 5
  19. )
  20. REM Interpret arguments
  21. :loop
  22. IF NOT "%1"=="" (
  23. IF "%1"=="-buildtools_link" (
  24. SET buildtools_link=%2
  25. SHIFT
  26. )
  27. IF "%1"=="-wsdk" (
  28. SET wsdk=%2
  29. SHIFT
  30. )
  31. SHIFT
  32. GOTO :loop
  33. )
  34. @ECHO ON
  35. if not exist "C:\TEMP\" mkdir C:\TEMP
  36. REM Install chocolatey to further install dependencies
  37. set chocolateyUseWindowsCompression='true'
  38. @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" ^
  39. -NoProfile -InputFormat None -ExecutionPolicy Bypass ^
  40. -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
  41. SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
  42. REM Install Visual Studio Toolchain
  43. choco install visualstudio2022buildtools --package-parameters "--quiet --wait --norestart --nocache --installPath ""%ProgramFiles%/Microsoft Visual Studio/2022/Community"" --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.140 --add Microsoft.VisualStudio.Component.VC.ATLMFC --add Microsoft.VisualStudio.Component.VC.Tools.ARM64 --add Microsoft.VisualStudio.Component.VC.MFC.ARM64 --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Component.Windows%wsdk% --includeRecommended"
  44. REM Install Windows SDK
  45. choco install windows-sdk-11-version-22h2-all
  46. REM Install nodejs python git and yarn needed dependencies
  47. choco install -y --force nodejs --version=20.17.0
  48. choco install -y python2 git yarn
  49. choco install python --version 3.7.9
  50. call C:\ProgramData\chocolatey\bin\RefreshEnv.cmd
  51. SET PATH=C:\Python27\;C:\Python27\Scripts;C:\Python39\;C:\Python39\Scripts;%PATH%
  52. if exist "C:\Users\appveyor\AppData\Roaming\npm" (
  53. rm -rf "C:\Users\appveyor\AppData\Roaming\npm"
  54. mkdir "C:\Users\appveyor\AppData\Roaming\npm"
  55. )
  56. if not exist "C:\Users\appveyor\AppData\Roaming\npm" (
  57. mkdir "C:\Users\appveyor\AppData\Roaming\npm"
  58. )
  59. REM Setup Depot Tools
  60. git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git C:\depot_tools
  61. SET PATH=%PATH%;C:\depot_tools\
  62. REM Add symstore to PATH permanently
  63. setx path "%%path%%;C:\Program Files (x86)\Windows Kits\10\Debuggers\x64"
  64. REM Add vs2022_install to environment variables
  65. SET vs2022_install="C:\Program Files\Microsoft Visual Studio\2022\Community"