Launch Program with Parameters

后端 未结 3 1571
后悔当初
后悔当初 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:37

    if you want to pass full executable path and parameters the program you need is the windows command prompt.

    0 讨论(0)
  • 2020-12-03 17:38

    Just create a new text file, name it "go.cmd" and put the following in there:

    "C:\etc\Program Files\ProgramFolder\Program.exe C:\etc\desktop\file.spp C\etc\desktop\file.txt"
    

    Voila, you have your program!

    0 讨论(0)
  • 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);
    
    0 讨论(0)
提交回复
热议问题