java - ProcessBuilder won't properly run with unified arguments with spaces in a path -


i trying pass processbuilder several arguments require tags @ beginning parameters (-). command-line command looks this, , runs fine when run in cmd.

msdeploy.exe -verb:sync -source:contentpath='\my\folder space\path' -dest:auto 

my project uses groovy script , implements processbuilder run command. processbuilder sees folder path having spaces, , therefore, working intended, places arg3 in quotations.

processbuilder passed arguments:

arg1 = msdeploy.exe arg2 = -verb:sync arg3 = -source:contentpath='c:\my\folder space\path' arg4 = -dest:auto 

processbuilder interprets , runs command as:

msdeploy.exe -verb:sync "-source:contentpath='c:\my\folder space\path'" -dest:auto 

the following error returned:

error: unrecognized argument '"-source:contentpath=c:\program files\udeploy\agent"'. arguments must begin "-". 

escaping characters not fix issue, because still recognizes spaces if they're escaped , adds quotations around entire -source argument. dash (-) must come first in msdeploy argument.

i need know how possible run unified arguments spaces in processbuilder have tags @ beginning, such '-'.

my cli cygwin when i'm obliged work in windows, in part because of problems this. equivalent command be:

msdeploy.exe -verb:sync -source:contentpath="/cygdrive/c/my/folder\ with\ space/path" 

the file separator forward slash , spaces must escaped backslash. takes guess work out.