Run a program with options

  • Thread starter Thread starter Ricardo
  • Start date Start date
R

Ricardo

How can i run a program with some options from my windows form??? I have a
fileinfo object with the name of the file...
 
If I understand you correctly, you are trying to execute another program from within your Windows Forms app, and the FileInfo object you are referring to holds the file information for the executable. You should use the System.Diagnostics.Process class. For example, if your FileInfo object were called myFile:

Process myProcess = new Process();
myProcess.StartInfo.FileName = myFile.FullName;
myProcess.StartInfo.Arguments = "<your options go here";
myProcess.Start();

The Process class has a large number of other members you might find useful. I suggest looking it up in the documentation.
 
If I understand you correctly, you are trying to execute another app from within your Windows Forms application, and the FileInfo object you are referring to holds the information for the executable. You should use the System.Diagnostics.Process class. For example, if your FileInfo object were called fi:

Process p = new Process();
p.StartInfo.FileName = fi.FullName;
p.StartInfo.Arguments = "<your options go here>";
p.Start();

The Process class has many other members you might find useful. I suggest looking it up in the documentation.
 
thx...
If I understand you correctly, you are trying to execute another program from within your Windows Forms app, and the FileInfo object you are referring to holds the file information for the executable. You should use the System.Diagnostics.Process class. For example, if your FileInfo object were called myFile:

Process myProcess = new Process();
myProcess.StartInfo.FileName = myFile.FullName;
myProcess.StartInfo.Arguments = "<your options go here";
myProcess.Start();

The Process class has a large number of other members you might find useful. I suggest looking it up in the documentation.
 
Back
Top