4 for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j
5 if "%version%" == "6.3" set currentOS=win8.1
6 if "%version%" == "6.2" set currentOS=win8
7 if "%version%" == "6.1" set currentOS=win7
8 if "%version%" == "6.0" set currentOS=winVista
9 if "%version%" == "10.0" set currentOS=win10
11 rem get this Computer Architecture
12 set currentArch=%processor_architecture%
15 echo This PC OS = %currentOS%
16 echo This PC arch = %currentArch%
22 rem invoke PowerShell to fetch CSV from the page on URL
23 for /f "tokens=*" %%i in ('powershell.exe -command "(Invoke-WebRequest -URI 'https://webinstall.dev/api/releases/%pkg%@%ver%.csv?os=%currentOS%&arch=%currentArch%&channel=stable&ext=zip&limit=1').Content"') do set return=%%i
25 rem Break apart the CSV returned by the webpage on URL
26 for /F "tokens=1-9 delims=," %%a in ("%return%") do (
33 rem Break apart parts of pkg_url to file name & directory
34 for /F "tokens=1-5 delims=/" %%a in ("%pkg_url%") do (
41 rem Final variable names as below.
42 echo Reurned CSV = %return% & echo.
43 echo Version = %version%
45 echo pkg_file = %pkg_file%
46 echo pkg_dir = %pkg_dir%
48 echo arch in CSV = %arch%
49 echo this PC OS = %currentOS%
50 echo this PC arch = %currentArch%