1

How should I quote following command to get desired output -

cmd.exe /c "C:\Remote\Remote.exe -u somedomain\Administrator -p i4D4KuHb0KTcpXObqf49ZbopthoFkC+yUYbkY6srPJ4= -util "C:\Program Files\V\Nt\bin\spprt\u.exe" -output winmas02_2018-12-18__12-23-37  -odir "C:\Program Files\Vx\NB\bin\spprt\winmas02_2018-12-18__12-23-37""

Here Remote.exe is C#.NET command application. -u -p -output -odir are getting passed to this (Remote.exe) correctly. Remote.exe is responsible to start u.exe under the impersonated context of give user credentials. I am using .net's Process and ProcessStartInfo classes here.u.exeis legacy non .net application

The current behavior -

Remote.exe is successfully launching u.exe however the quoted path passed to -odir parameter for u.exe is not working. 'u.exe' is failing because the path passed to -odir parameter is breaking at "C:\Program "

Any pointer on how to handle this?

Omkar
  • 2,129
  • 8
  • 33
  • 59
  • Unless there are special characters (`&<>()@^|`) between the enclosing quotes, inner quotes [should be preserved](https://stackoverflow.com/q/355988/69809), but you need to specify the `/s` parameter. – vgru Dec 18 '18 at 11:46

1 Answers1

0

Can you try -

cmd.exe /c "C:\Remote\Remote.exe" -u somedomain\Administrator -p "i4D4KuHb0KTcpXObqf49ZbopthoFkC+yUYbkY6srPJ4=" -util "C:\Program Files\V\Nt\bin\spprt\u.exe" -output "winmas02_2018-12-18__12-23-37" -odir "C:\Program Files\Vx\NB\bin\spprt\winmas02_2018-12-18__12-23-37"

Nilesh Shinde
  • 380
  • 1
  • 13