Change Cygwin’s user

I’ve tried looking for an option like “login” but didn’t work for me. As a workaround I use this:

Execute commands or scripts silently in Cygwin

If you want to run a command or an script in Cygwin silently use “run.exe”. Do not forget to scape commas.

Execute a Cygwin command /script silently using Jenkins

Just create a new project in Jenkins with the option “Run Windows batch” and add:

Execute a Cygwin command/script silently as a different user using Jenkins

For this one you’ll need to:

  • Create a file.bat
  • Optionally if you want to run a shell script create a .sh file
  • A Windows Task
  • A Jenkins Project

In this example I’m running a .bat which executes silently a shell script in cygwin as other user in Jenkins to copy all /etc/hosts files from many servers (don’t ask me why I had to do this horrible thing).

Bat file

Shell file

The windows task I’ve created is called “get_hosts_on_demand”

And finally in Jenkins just a job calling the windows task:

*The Job will return a false positive all the time.