Launch Program with Parameters

后端 未结 3 1572
后悔当初
后悔当初 2020-12-03 16:48

How do I write a very simple program that uses the command line to navigate to a program in the user\'s Program Files directory, then launches the .exe with a p

3条回答
  •  伪装坚强ぢ
    2020-12-03 17:52

    You can use the ProcessStartInfo.Arguments property to specify the string of arguments for your program:

    ProcessStartInfo startInfo = new ProcessStartInfo();        
    startInfo.FileName = @"C:\etc\Program Files\ProgramFolder\Program.exe";
    startInfo.Arguments = @"C:\etc\desktop\file.spp C:\etc\desktop\file.txt";
    Process.Start(startInfo);
    

提交回复
热议问题