Process.Start不开始 [英] Process.Start not starting

查看:113
本文介绍了Process.Start不开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试执行从.cmd批处理文件调用的第三方应用程序,该文件是从自托管WCF服务调用的。像这样:

I'm trying to execute a 3rd party application, called from a .cmd batch file, called from a self-hosted WCF service. Like this:

WCF-> .cmd->第三方应用程序

WCF --> .cmd --> 3rd party app

无论出于何种原因,使用Shell命令无法完全正常运行。它将调用.cmd文件,但是第3方应用程序将无法启动(我知道.cmd正在触发,因为我在回声语句之前/之后填充了一个日志文件)。如果我双击资源管理器中的.cmd文件,则第三方应用程序将开始正常运行。因此,我想到了,也许可以尝试使用WCF服务中的Shell命令之外的其他东西。

For whatever reason, using the Shell command doesn't work fully. It will call the .cmd file, but the 3rd party app won't kick off (I know the .cmd is firing because I have before/after ECHO statements populating a log file). If I double-click the .cmd file from explorer, the 3rd party app will start just fine. So, I figured, maybe try something besides the Shell command from my WCF service.

因此,我尝试了以下代码,但不会启动.cmd文件完全没有(echo语句不触发)。我在这里错过了什么?

So I tried the following code, but it won't kick off the .cmd file at all (echo statements not firing). What am I missing here?

Dim psi As New ProcessStartInfo("cmd.exe", "/C " & System.Configuration.ConfigurationManager.AppSettings("ExStream_CMD_File_Path"))

Dim proc As New Process()
proc.StartInfo = psi
proc.Start()
proc.WaitForExit()

app.config文件中的路径有效(只需仔细检查)。上面的代码有什么问题吗?

The path in the app.config file is valid (just double-checked). Is there anything wrong with the above code?

谢谢,
Jason

Thanks, Jason

推荐答案

在这里查看我对问题的第二次编辑:

Check out my second edit to the question here:

简单的软件测试工具-VB.NET

基本上,您需要确保加倍-使用 / C

Basically you need to make sure to double-escape the quotes around the command that you're executing with /C

这篇关于Process.Start不开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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