Hello,
Upto best of my knowledge, I know that system command takes string as input. This string can be of any thing, which works fine into command prompt. For example, we can call an executable using system command passing full path of executable as argument.
One thing I have observed is that system command does not work properly if argument string includes space into it. Solution for this is to use a double quote. For example, below works fine:
String strPathOfExe = “\”” + “C:\Program Files\Myexe.exe” + “\””;
System(strPathOfExe);
I am stuck in the case of executable asking for two arguments [One argument as specific word “YES” or “NO” and second argument as file path having space into it]. I have tried below but no success:
String strPathOfExe = “\”” + “C:\Program Files\Myexe.exe” + “ ” + “NO” + “ ” + “C:\Program Files\MyFile.xml” + “\””;
System(strPathOfExe);
Can anyone help me on this? I hope I have conveyed my problem statement. Feel free to ask for more details or further explanation if required.
Thanks in advance!
Regards
Ketan
> I would like to know whether system command does behave same as command line or not.
Yes, same as the host environment's standard command processor.
For instance, in Unix, the command is passed to /bin/sh.
> is it worth to use short path instead of this path?
It is better not to rely on the relative path. If the root path is configurable, compose a fully qualified path from the root path and the relative path (as in the example above). Often, the root path for the program is specified as an environment variable or as an entry in a run control file.