I have a bat file which sets some environment variables, and then executes a command on the command line. I want to replace the hard coded command with one passed in via a parameter.
So:
:: Set up the required environment
SET some_var=a
SET another_var=b
CALL some.bat
:: Now call the command passed into this batch file
%1
The problem is that the command is complex, and doesn't escape cleanly. It looks like this:
an.exe -p="path with spaces" -t="some text" -f="another path with spaces"
I'm trying to call the .bat from a .NET framework app, using:
Dim cmd as String = "the cmd"
System.Diagnostics.Process.Start( thebat.exe, cmd )
but I can't seem to get the escapes to work correctly. Can someone tell me how the string cmd should be entetered to get the command passed into the bat file as an argument correctly?