'In a Jenkins Pipeline script, how do I assign a path with a space to an environment variable?
I'm assigning a path with a space in it to an environment variable using the following syntax:
environment {
ZIP_HOME = "C:\\Program Files\\7-Zip"
}
I'm trying to use 7-Zip to zip my files and using the variable as the path to the 7-Zip executable.
bat "%ZIP_HOME%\\7z a programdata-${BUILD_NUMBER}.zip ${WORKSPACE}/Staging/programdata"
I also tried putting braces around ZIP_HOME.
bat "${ZIP_HOME}\\7z.exe a programdata-${BUILD_NUMBER}.zip ${WORKSPACE}/Staging/programdata"
I get the following message in the console output:
'C:\Program' is not recognized as an internal or external command
I also tried putting single quotes around 'Program Files' within the path above but get the same message.
The syntax I used for the bat "{ZIP_HOME}\7z is an answer I found on this site but it didn't work for me.
Thank you in advance.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
