例如,在PowerShell中,您可以执行以下操作:

> If((Get-Content '.\Config.json'|ConvertFrom-Json).RunEnvironment -eq 'DEV'){"is DEV:Whatever"}
is DEV:Whatever

在cmd行上成为话题

> for /f "tokens=1,2 delims=:{} " %A in (Config.json) do @If "%~B"=="Dev" @Echo (%~A = %~B)
(RunEnvironment=DEV)

在批处理文件中

@Echo off
for /f "tokens=1,2 delims=:{} " %%A in (Config.json) do (
    If "%%~B"=="Dev" Echo (%%~A=%%~B^)
)
Echo (%%~A=%%~B^)