application1 runs another application2 with 2 parameters eg: (NOTE: application1 is not my program)
application2.exe -d:C:\Program Files\app folder -z:Folder menu\app icons
Problem is... quotes somehow disappeared so instead of 2 parameters application2 will get 5 parameters
Param1=-d:C:\Program
Param2=Files\app
Param3=folder
Param4=-z:Folder menu\app
Param5=app icons
Is there way to retrieve all parameters as single string?
I tried combine parameters in loop
for i:=1 to ParamCount do
parameters=parameters+' '+ParamStr(i);
but it is not good solution, because path can contain also double or triple spaces eg.
Program files\app folder\
cmd.exe can capture all parameters in %* , but it gives wrong results if parameter contains special characters like ^^~@@&& ...
Call the Windows API function GetCommandLine
to retrieve the original command line.
var
CmdLine: string;
....
CmdLine := GetCommandLine;
You'd better hope that you never need to work with a file whose name contains a dash following a space! Trying to persuade the author of the other application to fix their programming would be prudent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With