windows C system call with spaces in command

后端 未结 1 811
独厮守ぢ
独厮守ぢ 2020-12-03 17:29

I cannot make system calls with spaces in the names and parameters. For example:

system(\"c:\\\\program files\\\\something\\\\example.exe c:\\\\my files\\\\e         


        
相关标签:
1条回答
  • 2020-12-03 17:56

    Edit: OK, figured it out by stepping into the system() call: you need an extra set of quotes around the whole thing due the fact that it internally calls cmd /c yourinput

    So this works for me:

    system("\"\"c:\\program files\\internet explorer\\iexplore.exe\" \"www.stackoverflow.com\"\"");
    

    A bit of a mess, isn't it?

    0 讨论(0)
提交回复
热议问题