# I need read and edit a file .json, wit script .bat

**URL:** <https://community.jenkins.io/t/i-need-read-and-edit-a-file-json-wit-script-bat/5769>\
**Category:** Ask a question\
**Tags:** windows\
**Created:** [February 14, 2023, 12:13pm UTC](https://community.jenkins.io/t/i-need-read-and-edit-a-file-json-wit-script-bat/5769 "2023-02-14T12:13:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samuelcloud07](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/samuelcloud07/32/2680_2.png) [@Samuelcloud07](https://community.jenkins.io/u/Samuelcloud07)\
**Post date:** [February 14, 2023, 12:13pm UTC](https://community.jenkins.io/t/i-need-read-and-edit-a-file-json-wit-script-bat/5769/1 "2023-02-14T12:13:52Z")

</div>

Hi everyone I am editing a pipeline, I need read and change value in a json, but script .bat  
this is part my code  
ren Output\${env.BUILD\_NUMBER}\${projectNameclon}\${projectNameclon}.${projVersion}\${projectName}.nuspec ${projectNameclon}.${projVersion}.json.

But I need edit the file json within the process with the script bat

---

<div class="post-metadata">

**Author:** ![slide\_o\_mix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/slide_o_mix/32/20977_2.png) [@slide\_o\_mix](https://community.jenkins.io/u/slide_o_mix)\
**Post date:** [February 14, 2023, 6:18pm UTC](https://community.jenkins.io/t/i-need-read-and-edit-a-file-json-wit-script-bat/5769/2 "2023-02-14T18:18:01Z")

</div>

If you need to modify it inside the bat file, you will probably need to make something like jq available to your script. If you can do the modifications in the pipeline, then you could use readJson, modify the returned object and then writeJson to write it back out.

---

<div class="post-metadata">

**Author:** ![Samuelcloud07](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/samuelcloud07/32/2680_2.png) [@Samuelcloud07](https://community.jenkins.io/u/Samuelcloud07)\
**Post date:** [February 16, 2023, 8:20pm UTC](https://community.jenkins.io/t/i-need-read-and-edit-a-file-json-wit-script-bat/5769/3 "2023-02-16T20:20:51Z")

</div>

Thank you for the answer.

Inside the bat now I try run this powershell.exe -ExecutionPolicy Unrestricted -Command

{“$a = Get-Content “Output\${env.BUILD\_NUMBER}\${projectNameclon}\${projectNameclon}.${projVersion}\lib\net45\project.json” -Raw | ConvertFrom-Json; $a | ForEach-Object{ $\_.name = “Estamos\_trabajando” }; $a | ConvertTo-Json -Depth 32 | Set-Content “Output\${env.BUILD\_NUMBER}\${projectNameclon}\${projectNameclon}.${projVersion}\lib\net45\project.json””}

When I do it in my local machine working fine but inside the pipeline break
