How to get dynamic value from Json file generated during execution and use it in next command for Jenkins pipeline?

I have a Script which is generating a Dynamic session_id in a json file and after execution of script I want to use that session_id in next command like for example below is JSON file


   "name": "TestName",
   "session_id": "51a2ce15-2caf-47e8-9415-405d623b4fb3"
   
}

I want to save it in a variable SessionID(or any other name) and then want to use in a command like below

npm run test --session_id %SessionID%

I have found a tool Jq which is used to play with JSON file, I installed it on my windows server.

And then in Jenkins step I’m trying to execute batch script for jq

steps {
                script {
                     bat "jq .session_id sessionFile.json > out.tmp"
                     bat "set /p SessionID=<out.tmp"
                     echo "%SessionID%"
                     bat "npm run test --session_id %SessionID%"
                }
            }

But getting jq is not recognised error in jenkins console log.

Then I tried manually to login on server and Executed command
jq .session_id sessionFile.json > out.tmp
It’s working fine as ADMIN user

C:/USERS/AUT >>  jq .session_id sessionFile.json > out.tmp

but for Jenkins as its running as C:ProgramDataJenkins.jenkinsworkspaceOrderCreation
So Tried command

C:ProgramDataJenkins.jenkinsworkspaceOrderCreation> jq .session_id sessionFile.json > out.tmp

It’s returning ‘Access is Denied’ reponse.

Can anyone please guide how to resolve the issue? OR s there any other alternative solution to handle this Problem?