Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to execute a batch file to copy my files to another server under the "Execute batch or shell script" option of the "PostBuildScript" plugin of Jenkins. These are the commands in my .bat file:

net use \\ /user:admin password
xcopy "C:\Program Files\Jenkins\workspace\Deployment code Test" "\\DeployServer\Workspace\Builds" /S/E/H/D/Y/V/C/I/K/R/X

When the .bat file is run from a command prompt, it runs as expected and completes its actions. When run through Jenkins, however, it gives following error messages:

System error 1312 has occurred. A specified logon session does not exist. It may already have been terminated. Invalid drive specification 0 File(s) copied

Are there any workarounds for this?

share|improve this question

Task Manager -> Services Tab -> Click Services button -> Select Jenkins Services -> Right click and go to Properties -> select Log On tab -> Select 'This Account' as the log on option -> Enter Administrator credentials -> Apply, Save and Restart the Service solved the issue.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.