I am working on a script in Windows to get system information , I want to store the result of each command in a bat variable, then pass them to php variables.
Here the script that I tried:
for /f "tokens=1 delims=[" %a in ('ver') do SET OS=%a
for /f "skip=1 tokens=1 delims=|" %a in ('wmic os get Name') do SET version=%a
for /f "tokens=2 delims=[" %a in ('ver') do SET kernel= %a
for /f "skip=1 tokens=1 delims= " %a in ('wmic os get osarchitecture') do SET arq=%a
for /f "skip=1 tokens=1 delims= " %a in ('wmic computersystem get numberofprocessors') do SET numero_cpu=%a
for /f "skip=1 tokens=1 delims= " %a in ('wmic cpu get manufacturer') do SET fabricante_cpu=%a
for /f "skip=1 tokens=1,2 delims=" %a in ('wmic cpu get Name') do SET nombre_cpu=%a
for /f "skip=1 tokens=1 delims=" %a in ('wmic cpu get CurrentClockSpeed') do SET frequence_cpu=%a
for /f "skip=1 tokens=1 delims=" %a in ('wmic bios get name') do SET name_bios=%a
for /f "skip=1 tokens=1 delims=" %a in ('wmic bios get version') do SET version_bios=%a
for /f "skip=1 tokens=1 delims=" %a in ('wmic bios get serialnumber') do SET serial_bios=%a
for /f "skip=1 tokens=1 delims=" %a in ('wmic bios get manufacturer') do SET fabricant_bios=%a
for /f "skip=1 tokens=1 delims=" %a in ('wmic NIC get Description') do SET red=%a
for /f "skip=1 tokens=1 delims=" %a in ('wmic SOUNDDEV get productname') do SET audio=%a
for /f "skip=1 tokens=1 delims=" %a in ('wmic PATH Win32_videocontroller GET description') do SET video= %a
ECHO %OS%:%version%:%kernel%:%arq%:%numero_cpu%:%fabricante_cpu%:%nombre_cpu%:%frequence_cpu%:%name_bios%:%version_bios%:%serial_bios%:%fabricant_bios%:%red%audio%:%video%:
Thank you!