c++进程启动路径问题
我正在使用 process::start(PATH); 来打开该进程。问题是,有时它找到该文件,有时却找不到。
例如,这有效:
process::start("C:\text.exe");
但这不起作用:
process::start("C:\New Folder\text.exe");
知道有什么区别吗?
I'm using process::start(PATH);
to open up the process. The problem is, sometimes it finds the file and sometimes it doesn't.
For example, this works:
process::start("C:\text.exe");
But this doesn't work:
process::start("C:\New Folder\text.exe");
Any idea what the difference is?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须转义
\
字符。在 C 字符串中,
\t
是 TAB 字符。使用:You have to escape the
\
characters.In a C string
\t
is the TAB character. Use:该库可能认为 c:\New 是您正在运行的程序,Folder\text.exe 是您传递给它的参数。
您可能需要引用它,因此您可以这样调用:
作为 C++ 字符串,它看起来像这样:
The library might think that c:\New is the program you are running, and Folder\text.exe is an argument you are passing to it.
You might need to quote it, so you're calling this:
Which as a C++ string would look like this: