【发布时间】:2016-09-21 04:49:37
【问题描述】:
试图从我的 c# 应用程序调用 perl 脚本。 perl 脚本有一个提示,要求用户在其中输入一些内容。我似乎无法让它显示。这是我用来调用它的函数。我有另一个函数将 System.Enviroment.SetEnvironmtVariable 设置为具有“C:\Perl\bin\;”的路径以及其他流程所需的其他人'
private void getRevisionAndUpdate()
{
Process myProcess = new Process();
myProcess.StartInfo.FileName = "cmd.exe";
myProcess.StartInfo.WorkingDirectory = @"the directory that has the perl script";
myProcess.StartInfo.Arguments = @"/c SaidPerlScript.pl";
myProcess.StartInfo.UseShellExecute = false;
myProcess.Start();
myProcess.WaitForExit();
}
正如我之前所说,它似乎可以运行,但它要么只是在记事本中打开脚本,要么什么都不做。还应该注意我已经尝试运行 cmd.exe 和 perl.exe。 cmd 似乎在记事本中打开它,而 perl 没有显示它应该显示的提示。
【问题讨论】: