if%_wmic%EQU 1 set"chkapp=for /f "tokens=2 delims=="%%a in ('"wmic path %spp% where (ApplicationID='%1') get ID /VALUE"%nul6%')"
if%_wmic%EQU 0 set"chkapp=for /f "tokens=2 delims=="%%a in ('%psc%"(([WMISEARCHER]'SELECT ID FROM %spp% WHERE ApplicationID=''%1''').Get()).ID ^|%% {echo ('ID='+$_)}"%nul6%')"
%chkapp% do (if defined allapps (call set "allapps=!allapps! %%a") else (call set "allapps=%%a"))
:: Check potential script crash issue when user manually installs way too many licenses for Office (length limit in variable)
if%_wmic%EQU 1 set"chkapp=for /f "tokens=2 delims=="%%a in ('"wmic path %spp% where (ApplicationID='%1') get ID /VALUE"%nul6%')"
if%_wmic%EQU 0 set"chkapp=for /f "tokens=2 delims=="%%a in ('%psc%"(([WMISEARCHER]'SELECT ID FROM %spp% WHERE ApplicationID=''%1''').Get()).ID ^|%% {echo ('ID='+$_)}"%nul6%')"
%chkapp% do (if defined allapps (call set "allapps=!allapps! %%a") else (call set "allapps=%%a"))
:: Check potential script crash issue when user manually installs way too many licenses for Office (length limit in variable)
if%_wmic%EQU 1 set"chkapp=for /f "tokens=2 delims=="%%a in ('"wmic path %spp% where (ApplicationID='%1') get ID /VALUE"%nul6%')"
if%_wmic%EQU 0 set"chkapp=for /f "tokens=2 delims=="%%a in ('%psc%"(([WMISEARCHER]'SELECT ID FROM %spp% WHERE ApplicationID=''%1''').Get()).ID ^|%% {echo ('ID='+$_)}"%nul6%')"
%chkapp% do (if defined allapps (call set "allapps=!allapps! %%a") else (call set "allapps=%%a"))
:: Check potential script crash issue when user manually installs way too many licenses for Office (length limit in variable)