Launch a program from ASP.NET C#

前端 未结 5 1252
暗喜
暗喜 2020-12-16 19:29

I have a program (I created) and I want to start it on the server when the webpage loads.

Here is the code I have

public partial class _Default : S         


        
5条回答
  •  天命终不由人
    2020-12-16 20:16

    You could use ProcessStartInfo.

    ProcessStartInfo psi = new ProcessStartInfo();
    psi.FileName = @"D:/Path to /My/Program to be run.exe";
    psi.WorkingDirectory = IO.Path.GetDirectoryName(psi.FileName);
    Diagnostics.Process.Start(psi);
    

提交回复
热议问题