# Corrupt content in jenkins-result.txt using bat step in pipeline in LTS 2.375.2

**URL:** <https://community.jenkins.io/t/corrupt-content-in-jenkins-result-txt-using-bat-step-in-pipeline-in-lts-2-375-2/5760>\
**Category:** Ask a question\
**Created:** [February 14, 2023, 9:05am UTC](https://community.jenkins.io/t/corrupt-content-in-jenkins-result-txt-using-bat-step-in-pipeline-in-lts-2-375-2/5760 "2023-02-14T09:05:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![han\_geerligs](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/han_geerligs/32/3240_2.png) [@han\_geerligs](https://community.jenkins.io/u/han_geerligs)\
**Post date:** [February 14, 2023, 9:05am UTC](https://community.jenkins.io/t/corrupt-content-in-jenkins-result-txt-using-bat-step-in-pipeline-in-lts-2-375-2/5760/1 "2023-02-14T09:05:49Z")

</div>

Hello,

suddenly one of my jobs started failing. It occurs when in a declarative pipeline a bat step is used:  
bat ‘echo just a string’

The response is:  
**09:49:25** d:\jenkinslocserver\workspace\Han\_Gitea\_testpush\_master@2\>echo just a string **09:49:25** just a string  
**09:49:25** Cannot contact AgentHan: java.io.IOException: corrupted content in d:\jenkinslocserver\workspace\Han\_Gitea\_testpush\_master@2@tmp\durable-e400d5a3\jenkins-result.txt: java.lang.NumberFormatException: For input string: “test;”

In fact the file jenkins-result.txt contains this string “test;”

When the bat step is replaced by an echo step everything runs fine.  
The bat step is also running fine inside a freestyle job but fails when using a pipeline.  
Also using the powershell step instead of the bat step resolves the issue.

Does anybody have a clue how to resolve this?

regards, Han

---

<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, 1:47pm UTC](https://community.jenkins.io/t/corrupt-content-in-jenkins-result-txt-using-bat-step-in-pipeline-in-lts-2-375-2/5760/2 "2023-02-14T13:47:32Z")

</div>

Have any windows updates been installed recent? What is the actual contents of the jenkins-result.txt file? If you add a ping -n 10 or something simple like that, does the result change?

---

<div class="post-metadata">

**Author:** ![han\_geerligs](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/han_geerligs/32/3240_2.png) [@han\_geerligs](https://community.jenkins.io/u/han_geerligs)\
**Post date:** [February 14, 2023, 2:06pm UTC](https://community.jenkins.io/t/corrupt-content-in-jenkins-result-txt-using-bat-step-in-pipeline-in-lts-2-375-2/5760/3 "2023-02-14T14:06:32Z")

</div>

When inserting a ping command this behaves correctly:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/jenkins/original/2X/3/375c41701f11c4ca48e28c848b6713847f1ff61c.png)  
But the result doesn’t change.

Last few days there haven’t been any windows updates.

Unfortunately I don’t see the file jenkins-result.txt anymore. But I remember from previous runs that it contains the string `test;`

---

<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, 2:17pm UTC](https://community.jenkins.io/t/corrupt-content-in-jenkins-result-txt-using-bat-step-in-pipeline-in-lts-2-375-2/5760/4 "2023-02-14T14:17:24Z")

</div>

Can you share your pipeline script?

---

<div class="post-metadata">

**Author:** ![han\_geerligs](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/han_geerligs/32/3240_2.png) [@han\_geerligs](https://community.jenkins.io/u/han_geerligs)\
**Post date:** [February 14, 2023, 2:18pm UTC](https://community.jenkins.io/t/corrupt-content-in-jenkins-result-txt-using-bat-step-in-pipeline-in-lts-2-375-2/5760/5 "2023-02-14T14:18:07Z")

</div>

pipeline {  
agent any

```
stages {
    stage('Hello') {
        steps {
            echo 'Hello World'
            bat 'ping localhost -n 10'
            bat 'echo my pipeline'
        }
    }
}

```

}

---

<div class="post-metadata">

**Author:** ![han\_geerligs](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/han_geerligs/32/3240_2.png) [@han\_geerligs](https://community.jenkins.io/u/han_geerligs)\
**Post date:** [February 15, 2023, 7:46am UTC](https://community.jenkins.io/t/corrupt-content-in-jenkins-result-txt-using-bat-step-in-pipeline-in-lts-2-375-2/5760/6 "2023-02-15T07:46:55Z")

</div>

Hi Alex,

I found the cause of the issue. In my profile the variable ERRORLEVEL was set to ERRORLEVEL=test; This was causing the durable step to use this as exit code, which could not be interpreted.

Thanks for your support and sorry for any inconvenience.

–Han

---

<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 15, 2023, 3:08pm UTC](https://community.jenkins.io/t/corrupt-content-in-jenkins-result-txt-using-bat-step-in-pipeline-in-lts-2-375-2/5760/7 "2023-02-15T15:08:33Z")

</div>

Interesting! I will keep that in mind if someone sees a similar issue in the future. Glad its working now!
