我如何才能找到为什么系统无法运行我的应用程序? [英] How can I find why system can not run my application?

查看:177
本文介绍了我如何才能找到为什么系统无法运行我的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行一个命令,并传递一些参数给它的C ++程序。在code是如下:

I have a c++ program that run a command and pass some arguments to it. The code is as follow:

 int RunApplication(fs::path applicationPathName,std::string arguments)
 {
    std::string applicationShortPath=GetShortFileName(applicationPathName);
    std::string cmd="\""+applicationShortPath +"\"  "+ arguments+" >>log.txt 2>&1 \"";
    std::cout<<cmd<<std::endl;
    int result=std::system(cmd.c_str());
    return result;
 }

当我运行系统命令,不久将出现cmd窗口,然后关闭,但结果是1,CMD没有运行(该命令应产生无法产生输出)。

When I run system command, the cmd window appears shortly and then closes, but the result is 1 and the cmd was not run (the command should generate output which is not generated).

要检查cmd是正确的,我只是系统线路及复印件之前停止应用/内容CMD粘贴到cmd窗口和它的工作。

To check that the cmd is correct, I stopped the application just before system line and copy/ paste cmd content to a cmd window and it worked.

我想知道我怎么能找到,为什么应用程序没有在系统中运行()?

I am wondering how can I find why application is not run in system()?

cmd中有这个值只是运行它之前:

the cmd has this value just before running it:

"D:/DEVELO~3/x64/Debug/enfuse.exe"  -w --hard-mask --exposure-weight=1 --saturation-weight=0.328 --contrast-weight=0.164 -o "C:/Users/m/AppData/Local/Temp/1.tif"  "C:/Users/m/AppData/Local/Temp/1.jpg" "C:/Users/m/AppData/Local/Temp/2.jpg"  >>log.txt 2>&1 "

我如何才能找到它为什么不工作?

How can I find why it is not working?

有什么办法,我设置系统,因此它不会关闭cmd窗口,所以我可以检查吗?

Is there any way that I set the system so it doesn't close cmd window so I can inspect it?

有没有更好的方式来运行操作系统的命令?

is there any better way to run a command on OS?

升压是否有这方面的任何解决方案?

Does Boost has any solution for this?

用CMD / K运行它后,我得到这个错误信息:

After running it with cmd /k, I get this error message:

The input line is too long.

我怎样才能修复它除了减少CMD线?

How can I fix it other than reducing cmd line?

推荐答案

使用 CMD / K 来保持终端:的 http://ss64.com/nt/cmd.html

或者只是产卵的cmd.exe 代替,检查环境,权限等,您可以手动粘贴命令,看看它是否会从壳工作。如果是这样,你知道路径,permssions和环境是好了,你有一些其他的问题,在您的手中(参数转义,字符编码问题)

Or just spawn cmd.exe instead and inspect the environment, permissions, etc. You can manually paste that command to see whether it would work from that shell. If it does, you know that paths, permssions and environment are ok, so you have some other issue on your hands (argument escaping, character encoding issues)

这篇关于我如何才能找到为什么系统无法运行我的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆