Jenkins handles spaces in group file arguments

I am setting up Jenkins on Windows to take care of the builds for the Windows project I was working on. So far, I just built locally. I have a batch file that builds, which leads to the creation of some MSI installers.

Some of the projects contain post-build steps that run batch files. Arguments to batch files sometimes contain spaces. This is not a problem when I run the build command file from the command line.

However, Jenkins has a problem with this - I get errors like

"File not found: C: \ Program"

I am puzzled why the error occurs when Jenkins launches a package, but not when I run it manually - any ideas?

+4
source share
2 answers

For arguments containing spaces, wrap them in double quotes. Example:

WRONG: PROCESS_FILE.EXE C: \ Program Files \ This File.txt

CORRECT: PROCESS_FILE.EXE "C: \ Program FIles \ This File.txt"

+3
source

As Jason mentions, you need to pass your arguments and paths with quotes.

Also check the build log and see what type of quotes you use. Depending on where it is being transmitted, you may need single or double quotes or some kind of escape character.

If you want to see the actual batch file that Jenkins runs for your external commands or events before and after the build, check the build log and load the temporary batch file in the editor to see how it actually looks. Sometimes it is necessary to debug your assembly.

0
source

All Articles