I had this working on my windows 10 machine, it stopped working when i tried it on windows server. Not exactly sure how to fix it so im hoping someone can assist.
It’s supposed to run the batch, and return the value from the json object but it just throws the error mentioned below in the screenshot.
My Batch File:
for /f "usebackqdelims=" %%a in (`powershell.exe -NoProfile -Command "(Get-Content "C:JBGPuser_files00000database.json" -Raw | ConvertFrom-Json).Server.serverID"`) Do Set serverID=%%a
echo %serverID%
pause
My JSON file:
{
"Users": [
{
"userID": "000000",
"userName": "USER1",
"passWord": "XXXXXXXXXX"
}
],
"Server": [
{
"serverID": "000000",
"gameTitle": "7 Days To Die",
"appID": "294420",
"serverName": "JunkBox Games PvE",
"assignedPort": "26900",
"commandLine": ""
}
]
}
It gives this error:
Screenshot
Did i do something wrong or?