Description: |
call:getServices var |
Script: |
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12.
|
:getServices var -- returns array of service information
:: -- var [out] - return variable, as array
:$created 20060101 :$changed 20091113 :$categories ServiceControl,Array
:$source https://www.dostips.com
set /a %~1[#]=-1
for /f "tokens=*" %%x in ('"sc queryex state= all type= service"') do (
for /f "tokens=1,* delims=: " %%a in ("%%x") do (
if "%%a"=="SERVICE_NAME" set /a %~1[#]+=1
call set %~1[%%%~1[#]%%].%%a=%%b
)
)
EXIT /b
|
|