简体   繁体   English

如何使用process.start启动setup.exe文件

[英]How to launch a setup.exe file using process.start

I've a free trial launcher for the Final Fantasy XIV game. 我为Final Fantasy XIV游戏提供了免费试用版启动器。 Now I want to launch it through process.start in a windows service in C#. 现在,我想在C#的Windows服务中通过process.start启动它。 the process starts successfully, as I can see it in the windows task manager, but it does not launch the setup file. 该过程成功启动,正如我在Windows任务管理器中看到的那样,但是它没有启动安装文件。 Here is the code I've tried. 这是我尝试过的代码。

try {
   var process = new Process();
   var startInfo = new ProcessStartInfo
   {
     WindowStyle = ProcessWindowStyle.Normal,
     FileName = "cmd.exe",
     Arguments = "/C " + setupFile + " /DIR=" + installLocation,
   };

   process.StartInfo = startInfo;
   process.Start();
   process.WaitForExit();
}
catch (Exception ex)
{
  Logger.Log.Error("Error Installing game.", ex);
}

Where setupfile is the complete path for ffxivsetup_ft.exe. 其中setupfile是ffxivsetup_ft.exe的完整路径。

Try this code : 试试这个代码:

ProcessStartInfo startInfo = new ProcessStartInfo(path);
Process.Start(startInfo);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM