Description: |
call:set var=command |
Dependencies: |
:removeArr |
Script: |
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16.
|
:set var=command -- sets var[] to output of command / under construction
:: -- var [out] varref of target variable
:: -- command [in] command to be parsed, i.e. ipconfig /all
:$created 20060101 :$changed 20080219
:$source https://www.dostips.com
for /f "tokens=1,* delims==" %%x in ("%*") do (
call:removeArr "%%x"
if "%%y" NEQ "" (
for /f "tokens=1,2 delims=]" %%a in ('"%%y|find /n /v """') do (
set "%%x%%a]=%%b"
set "%%x[#]=%%a"
)&&call set "%%x[#]=%%%%x[#]:~1%%"
)
call set "%%x=%%%%x[1]%%"
)
EXIT /b
|
|