I\'m trying to get a Computer System Model type via Batch file. for this i\'ve created this script:
systeminfo | find \"System Model\" > %temp%\\TEMPSYSINFO.t
For what it's worth, I tried this and it replaced all double spaces to nothing,
with echo =%SYSMODEL%= producing :
=my sysmodel = (just one trailing space) :)
set SYSMODEL=%SYSMODEL: =%
EDIT
So, using Peter's excellent suggestion to put the piped commands into the FOR /F, which I tried that before but came unstuck with a plain | instead of ^| :)
for /F "tokens=2 delims=:" %%a in ('systeminfo 2^>nul ^| find "System Model"') do set SYSMODEL=%%a
set SYSMODEL=%SYSMODEL: =%
EDIT 2
rojo's answer is great, but it still leaves trailing space for me, so I ended up still using the %var: =% trick
for /f "tokens=2 delims==" %%a in ('wmic computersystem get model /format:list') do set SYSMODEL=%%a
set SYSMODEL=%SYSMODEL: =%
echo =%SYSMODEL%=