Launch Program with Parameters
57,068
Solution 1
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);
Solution 2
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!
Related videos on Youtube
Author by
mark
Updated on July 09, 2022Comments
-
mark almost 2 years
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 parameter? For example:"C:\etc\Program Files\ProgramFolder\Program.exe C:\etc\desktop\file.spp C\etc\desktop\file.txt"
This launches a program with a certain project file and a
.txt
file along with it.-
David Heffernan about 13 yearsI don't understand. All known desktop OS allow you to launch programs and pass command line arguments. Please, what is your question?
-
-
mark about 13 yearsoh i'm sorry, seemed to have left out a big piece of information(sorry). i need this program to prompt the user, asking what files they want to pass as parameters, then actually putting it into the command line