Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Windows Path issue in Shell/Batch Steps #1353

max1234 ·
Hi,

I am sorry if this has already been covered in the forum, but i am trying to run a shell/batch step on windows build agent running in console mode. It uses this as a parameter being passed.

-m ${configuration.getWorkspaceDir()}/${vars.getValue("cmConfig")}/${vars.getValue("departmentName")}/${vars.getValue("projectName")}/${vars.getValue("projectName")}_deploy_dir_mapping.txt

The workspace path is under C:\Program Files. The script fails due to the space. I tried to use "" around the argumetn being passed. It works however the workspace path does not contain any "\" in it for some readon and also the ":" symbol gets resolved by some undefined symbol.

I tried different variations liek using \" or even double quotes twice, but nothing seemed to work. Can you please suggest how i can get this to work.
  • replies 5
  • views 2251
  • stars 0
robinshen ADMIN ·
Please try with below syntax:
-m "${configuration.getWorkspaceDir().absolutePath().replace("\", "/")}"/${vars.getValue("cmConfig")}/${vars.getValue("departmentName")}/${vars.getValue("projectName")}/${vars.getValue("projectName")}_deploy_dir_mapping.txt


Regards
Robin
max1234 ·
Hi Robin,

On using the expression i get the value for workspace as C:uildagentworkspaceProjectName...

The QB server runs off of linux box and the agent on windows XP. The build agent is installed in C:\Program Files\....

Thank you,
robinshen ADMIN ·
I tested and it works at my side. In the script, I intentionally replaced the "\" (escape form for "\") with "/" to avoid the issue. How about changing the double quotes with single quote inside the replace method? That is:
-m "${configuration.getWorkspaceDir().absolutePath().replace('\', '/')}"/${vars.getValue("cmConfig")}/${vars.getValue("departmentName")}/${vars.getValue("projectName")}/${vars.getValue("projectName")}_deploy_dir_mapping.txt


If it still does not work, you may send backup of your database to robin AT pmease DOT com, and tell me which configuration and which step to look at.
tardis4500 ·
I am having a similar issue but it does not work. To test I have a single step which does the following on a Windows agent:
echo ${configuration.getWorkspaceDir()}
Which works fine and results in
F:\qbwork\dev\CFC\Test\QB Space Test
But I really need the string quoted because of the space so I try:
echo "${configuration.getWorkspaceDir()}"
Unfortunately, this results in:
F:qbworkdevCFCTestQB Space Test

How can I get it with both the quotes and the backslashes?
robinshen ADMIN ·
Please use below code instead:
echo "${configuration.workspaceDir.absolutePath.replace("\", "\\")}"