Loading a file with other programs

  • Thread starter Thread starter Tomomichi Amano
  • Start date Start date
T

Tomomichi Amano

How do I load a file(folder) with notepad , internet explorer and explorer
in a C# program?
 
Hi,

The sample code below:

using System.Diagnostics;

// Notepad
Process process = new Process();
process.StartInfo.FileName = "notepad";
process.StartInfo.Arguments = "myFile.txt";
process.StartInfo.UseShellExecute = true;
process.Start();
process.WaitForExit();

// Windows Explorer
Process process = new Process();
process.StartInfo.FileName = "explorer";
process.StartInfo.Arguments = "c:\temp";
process.StartInfo.UseShellExecute = true;
process.Start();
process.WaitForExit();

// IE
Process process = new Process();
process.StartInfo.FileName = "file:///e:/temp/myfile.txt";
process.StartInfo.Arguments = "";
process.StartInfo.UseShellExecute = true;
process.Start();
process.WaitForExit();
 
Hi,

Your question is not very clear, if what you want to do is start a new
process you can use System.Diagnostics.Process class, this allow you to
especify the command line you want.

hope this help,
 
Back
Top