Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins coping with spaces in batch file arguments

I'm setting up Jenkins on Windows to take care of the builds for a Windows project I've been working on. Until now, I've just been building locally. I've got a batch file that performs the build, which ends up generating some msi installers.

Some of the projects contain post builds steps that run batch files. The arguments to the batch files sometimes contain spaces. This isn't a problem when I run my build batch file from the command prompt.

However, Jenkins seems to have a problem with this - I get errors such as

"File not found: C:\Program"

I'm puzzled as to why the error happens when Jenkins triggers the batch, but not when I run it manually - any ideas?

like image 824
Tom Davies Avatar asked Oct 23 '22 13:10

Tom Davies


1 Answers

For arguments that include 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"

like image 172
Jason Swager Avatar answered Oct 26 '22 22:10

Jason Swager