title: Jenkins Windows Execute Command Line BitVise sexec Fails with exit 1000 at the end
body: <p>I am just setting up a new Jenkins system on Windows server 2016.</p>
  
  <p>One of my build steps is to execute a batch file that I have been using with FinalBuilder.</p>
  
  <p>This batch file creates a 7z backup of my existing web site before over writing it.</p>
  
  <p>Here is my command in Jenkins (some parameters obviously changed for privacy in this post):</p>
  
  <pre><code>sexec myuser@myserver.cloudapp.net -pw=mypassword -cmd="bvBackup C:\inetpub\SiteName SiteName"
  </code></pre>
  
  <p>Here is bvBackup.bat contents:</p>
  
  <pre><code>cd %1
  for /f "tokens=2-8 delims=.:/ " %%a in ("%date% %time%") do set DateNtime=%%c-%%a-%%b_%%d-%%e-%%f
  7z a -r ..\%2Backup\%2_%DateNtime% *.*
  </code></pre>
  
  <p>Basically it just zips the files up into an archive with the current date and time in the name.</p>
  
  <p>Here are the last few lines of the output from the Jenkins console:</p>
  
  <pre><code>12:14:42 Compressing  site\bin\UserAuthorization.dll
  12:14:42 Compressing  site\bin\WebGrease.dll
  12:14:42 Compressing  site\bin\zlib1.dll
  12:14:42 
  12:14:42 Everything is Ok
  12:14:42 
  12:14:42 D:\Jenkins\workspace\MyProjectName - Staging&gt;exit 1000 
  12:14:42 Build step 'Execute Windows batch command' marked build as failure
  12:14:42 Finished: FAILURE
  </code></pre>
  
  <p>What I am trying to figure out is where the exit 100 is coming from. That is not part of my batch file. 7zip is saying everything is Ok.</p>
  
  <p>The path on D: is the jenkins working folder path. Everything else is from our staging server where the compressing is happening over sexec ssh shell.</p>
  
  <p>Why is this failing when the output from the work seems to be fine? Where is the exit 1000 coming from?</p>
  
  <p><strong>Update:</strong> Turns out the exit 1000 is coming from the sexec and is normal. I have tried several things in my batch file that is getting executed to deal with it, but Jenkins always assumes it is a bad state and fails the build.</p>
  
  <p>Can someone tell me how to tell Jenkins that exit 1000 is success when using Windows Batch Execution?</p>