如何在asp.net c中使用参数运行exe文件# [英] how to run exe file with argument in asp.net c#
本文介绍了如何在asp.net c中使用参数运行exe文件#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
i我在cmd中运行一个带有2个参数的EXE应用程序这样的
d :\ work\sample.exe第一秒
工作正常。但是当我运行EXE应用程序抛出这样的代码时
hello
i am running one EXE application with 2 argument in cmd like this
"d:\work\sample.exe first second"
its working fine. but when i run EXE application throw code like this
System.Diagnostics.Process process1 = new System.Diagnostics.Process();
process1.StartInfo.FileName = "d:\work\sample.exe");
process1.StartInfo.Arguments = "first second";
process1.Start();
process1.WaitForExit();
process1.Close();
执行罚款,但不给任何结果。
此EXE应用程序使用文件。
我做错了什么
还有一件事我也可以看到命令窗口打开但打开后关闭,如果它的工作正常则可以打开10秒。我不明白这个问题。
请帮帮我。
its execute fine but give not any result.
this EXE applicaiton work with file.
whats have i done wrong.
also one thing i can also see the command window opening but its close after open, if its work fine then it can open for 10 sec. i don't understand the problem.
pls help me.
推荐答案
代码是正确的:它应该可以正常工作,除了反斜杠可执行字符串中的字符。
请改为尝试:
The code is correct: it should work fine, except the backslash characters in the executable string.
Try this instead:
process1.StartInfo.FileName = @"d:\work\sample.exe");
这篇关于如何在asp.net c中使用参数运行exe文件#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文