好的,所以我完全重写了这个代码,试图让这个更简单。现在它告诉我“类型或命名空间定义,或期望的文件结束。我只能认为我的间距是关闭或我错过了一个括号,但当我尝试添加一个括号时,我得到相同的错误。我想做的就是为我的EXE创建一个简单的包装器,它非常令人沮丧。请尽可能查看我的代码并告诉我这里的错误。欢迎任何帮助...
using System.IO;
//using Resources.resx;
namespace EXE_program
{
public class LaunchEXE
{
static void Main(string[] args)
{
string exeName = Path.Combine(Directory.GetCurrentDirectory(), "EntUpdate_v3.0.exe");
string argsLin = "";
int timeoutSeconds = 100;}
internal static string Run(string exeName, string argsLine, int timeoutSeconds)
{
StreamReader outputStream = StreamReader.Null;
string output = "";
bool success = false;
Process newProcess = new Process();
newProcess.StartInfo.FileName = exeName;
newProcess.StartInfo.Arguments = argsLine;
newProcess.StartInfo.UseShellExecute = false;
newProcess.StartInfo.CreateNoWindow = true; //The command line is supressed to keep the process in the background
newProcess.StartInfo.RedirectStandardOutput = true;
newProcess.Start();
return "\t" + output; }
}
}
}