我的项目确实有最后一个问题,我只是看不清这里到底出了什么问题。
当我用它运行我的代码时,一切都很完美:
Dim p As Process = New Process()
With p.StartInfo
.WorkingDirectory = Environment.GetEnvironmentVariable("ProgramFiles") & "\rest_of_my_path\"
.FileName = "ping"
.Arguments = "192.168.0.24"
.CreateNoWindow = True
.UseShellExecute = False
.RedirectStandardOutput = True
.RedirectStandardError = True
End With
p.Start()
但是,当我运行它时,它会在运行时出错并在 p.start() 上崩溃
Dim p As Process = New Process()
With p.StartInfo
.WorkingDirectory = Environment.GetEnvironmentVariable("ProgramFiles") & "\rest_of_my_path\"
.FileName = "myextprogram.exe"
.Arguments = "-n Unnamed -f file.abc"
.CreateNoWindow = True
.UseShellExecute = False
.RedirectStandardOutput = True
.RedirectStandardError = True
End With
p.Start()
我尝试添加空格,引号,只是命名它,但总是得到一个Exception has been throwed by the target of an invocation。我相信它在抱怨路径。
我几乎可以肯定它很简单,但就是不能把我的手指放在它上面。
任何帮助表示赞赏。