Loading a file with other programs

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tomomichi Amano

    #1

    Loading a file with other programs

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

  • Dmitriy Lapshin [C# / .NET MVP]

    #2
    Re: Loading a file with other programs

    Hi,

    The sample code below:

    using System.Diagnost ics;

    // Notepad
    Process process = new Process();
    process.StartIn fo.FileName = "notepad";
    process.StartIn fo.Arguments = "myFile.txt ";
    process.StartIn fo.UseShellExec ute = true;
    process.Start() ;
    process.WaitFor Exit();

    // Windows Explorer
    Process process = new Process();
    process.StartIn fo.FileName = "explorer";
    process.StartIn fo.Arguments = "c:\temp";
    process.StartIn fo.UseShellExec ute = true;
    process.Start() ;
    process.WaitFor Exit();

    // IE
    Process process = new Process();
    process.StartIn fo.FileName = "file:///e:/temp/myfile.txt";
    process.StartIn fo.Arguments = "";
    process.StartIn fo.UseShellExec ute = true;
    process.Start() ;
    process.WaitFor Exit();

    --
    Dmitriy Lapshin [C# / .NET MVP]
    X-Unity Test Studio

    Bring the power of unit testing to VS .NET IDE

    "Tomomichi Amano" <tomomichi_a@ho tmail.com> wrote in message
    news:OzkW6BQgDH A.3528@tk2msftn gp13.phx.gbl...[color=blue]
    > How do I load a file(folder) with notepad , internet explorer and explorer
    > in a C# program?
    >[/color]

    Comment

    • Ignacio Machin

      #3
      Re: Loading a file with other programs

      Hi,

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

      hope this help,

      --
      Ignacio Machin,
      ignacio.machin AT dot.state.fl.us
      Florida Department Of Transportation

      "Tomomichi Amano" <tomomichi_a@ho tmail.com> wrote in message
      news:OzkW6BQgDH A.3528@tk2msftn gp13.phx.gbl...[color=blue]
      > How do I load a file(folder) with notepad , internet explorer and explorer
      > in a C# program?
      >[/color]


      Comment

      Working...