У меня есть вопрос, похожий на Пакет Windows: запросить wmic computerystem получить модель, если равно true, продолжить с пакетом Windows
У меня есть пакетный файл, который использует wmic для получения номера модели системы, и мне нужно будет запустить скрипт на основе номера модели
Вот мой сценарий
REM @echo off
setlocal enableextensions disabledelayedexpansion
for /f "tokens=2 delims==" %%a in (
'wmic computersystem get model /value'
) do for /f "delims=" %%b in ("%%~a") do for %%m in (
"HP t520 Flexible Series TC" "HP t610 WW Thin Client" "HP t620 Quad Core TC" "HP t630 Thin Client"
) do if /i "%%~b"=="%%~m" (
set "model=%%~m"
goto start
)
echo un-compatible system
goto :eof
:start
echo Start of script for model [%model%]
if [%model%]==[t520] start "" "C:\SWSetup\APP\Scripts\t520.bat" "C:\SWSetup\APP\Scripts\t520-wmi.bat"
if [%model%]==[t610] start "" "C:\SWSetup\APP\Scripts\t610.bat" "C:\SWSetup\APP\Scripts\t610-wmi.bat"
if [%model%]==[t620] start "" "C:\SWSetup\APP\Scripts\t620.bat" "C:\SWSetup\APP\Scripts\t620-wmi.bat"
if [%model%]==[t630] start "" "C:\SWSetup\APP\Scripts\t630.bat" "C:\SWSetup\APP\Scripts\t630-wmi.bat"
Вот вывод окна cmd
C:\SWSetup\APP\Scripts>setlocal enableextensions disabledelayedexpansion
C:\SWSetup\APP\Scripts>for /F "tokens=2 delims==" %a in ('wmic computersystem get model /value') do for /F "delims=" %b in ("%~a") do for %m in ("HP t520 Flexible Series TC" "HP t610 WW Thin Client" "HP t620 Quad Core TC" "HP t630 Thin Client") do if /I "%~b" == "%~m" (set "model=%~m"
goto start
)
") do for %m in ("HP t520 Flexible Series TC" "HP t610 WW Thin Client" "HP t620Quad Core TC" "HP t630 Thin Client") do if /I "%~b" == "%~m" (set "model=%~m"
goto start
)
C:\SWSetup\APP\Scripts>for %m in ("HP t520 Flexible Series TC" "HP t610 WW Thin Client" "HP t620 Quad Core TC" "HP t630 Thin Client") do if /I "HP t520 Flexible Series TC" == "%~m" (set "model=%~m"
goto start
)
C:\SWSetup\APP\Scripts>if /I "HP t520 Flexible Series TC" == "HP t520 Flexible Series TC" (set "model=HP t520 Flexible Series TC"
goto start
)
C:\SWSetup\APP\Scripts>echo Start of script for model [HP t520 Flexible Series TC] Start of script for model [HP t520 Flexible Series TC] t520 was unexpected at this time.
C:\SWSetup\APP\Scripts>if [HP t520 Flexible Series TC]==[t520] start "" "C:\SWSetup\APP\Scripts\t520.bat" "C:\SWSetup\APP\Scripts\t520-wmi.bat"
Что мне здесь не хватает?