This solves the question:
@echo off
setlocal EnableDelayedExpansion
set c=0
for /f "tokens=2 delims=:, " %%a in (' find ":" ^< "config.json" ') do (
set /a c+=1
set val[!c!]=%%~a
)
for /L %%b in (1,1,!c!) do echo !val[%%b]!
pause
This version will output version = 0.2.2and the test = true
only change in line 6
@echo off
setlocal EnableDelayedExpansion
set c=0
for /f "tokens=1,2 delims=:, " %%a in (' find ":" ^< "config.json" ') do (
set /a c+=1
set val[!c!]=%%~a = %%~b
)
for /L %%b in (1,1,!c!) do echo !val[%%b]!
pause
This solves the following format request: variable-name = value
@echo off
for /f "tokens=1,2 delims=:, " %%a in (' find ":" ^< "config.json" ') do (
set "%%~a=%%~b"
)
set
pause
A request from February 2016 can be resolved given that the file looks like this:
{
location : "C:\\Test Folder"
}
Package script below
@echo off
for /f "tokens=1,2,*" %%a in (' find ":" ^< "config.json" ') do echo "%%~c"
pause