system() parameter complications
-
Alright, I'm trying to have my program, which was writting in C++ using Dev-Cpp 4.9.9.2, open a separate program. I know this can be achieved throw the use of system() but I can't seem to get it to work right, I'm currently using the command line:
system("c:\\Program Files\\Internet Explorer\\iexplorer.exe");
I get the error "'c:\Program' is not recognized as an internal or external command, operable program or batch file."
-
Alright, I'm trying to have my program, which was writting in C++ using Dev-Cpp 4.9.9.2, open a separate program. I know this can be achieved throw the use of system() but I can't seem to get it to work right, I'm currently using the command line:
system("c:\\Program Files\\Internet Explorer\\iexplorer.exe");
I get the error "'c:\Program' is not recognized as an internal or external command, operable program or batch file."
-
It's just a command line, as passed to CMD, so put double quotes around the path as it contains spaces:
system("\"c:\\Program Files\\Internet Explorer\\iexplorer.exe\"");
-
Isn't it iexplore.exe, not iexplorer.exe?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
-
-
It's just a command line, as passed to CMD, so put double quotes around the path as it contains spaces:
system("\"c:\\Program Files\\Internet Explorer\\iexplorer.exe\"");
-
Isn't it iexplore.exe, not iexplorer.exe?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
Thanks again Stuart really appreciating all the help you're giving me. That one worked perfect on the first try. I didn't know anything about double quotes until a little bit before i posted this issue. I looked up other examples on google and when I tried it with the double quotes before it told me the same issue. But having just tested it with the line still saying iexplorer instead of iexplore it gave the error again, so it looks like that was my issue.. really need to stop doing this at 2 am..
-
-
Thanks again Stuart really appreciating all the help you're giving me. That one worked perfect on the first try. I didn't know anything about double quotes until a little bit before i posted this issue. I looked up other examples on google and when I tried it with the double quotes before it told me the same issue. But having just tested it with the line still saying iexplorer instead of iexplore it gave the error again, so it looks like that was my issue.. really need to stop doing this at 2 am..
The message you showed, saying that 'c:\Program' wasn't recognised, is a giveaway that you're having issues with spaces in the command-line. If you see it in the future, that's what your issue will be...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p