Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How do I start programs from a C# program?

How do I start programs from a C# program?

Scheduled Pinned Locked Moved C#
helpquestioncsharptutoriallounge
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    False Chicken
    wrote on last edited by
    #1

    Is there any way to start programs from the same folder as your C# program without getting a file not found exception? the only way I can seem to fix it is to put the other files into the root of C:\ and telling the program System.Diagnostics.Process.Start(@"C:\example.exe");. But the problem is I have an installer that puts all the files into "C:\program files\Random Title here". And that folder is what ever the user wants it to be, so I cant make my program predict that so just typeing System.Diagnostics.Process.Start(@"Example.exe"); gives me a file not found Exception unless i tell it to always install it "C:\". Any advice?

    Y*Live Long And Prosper*Y

    A G R 3 Replies Last reply
    0
    • F False Chicken

      Is there any way to start programs from the same folder as your C# program without getting a file not found exception? the only way I can seem to fix it is to put the other files into the root of C:\ and telling the program System.Diagnostics.Process.Start(@"C:\example.exe");. But the problem is I have an installer that puts all the files into "C:\program files\Random Title here". And that folder is what ever the user wants it to be, so I cant make my program predict that so just typeing System.Diagnostics.Process.Start(@"Example.exe"); gives me a file not found Exception unless i tell it to always install it "C:\". Any advice?

      Y*Live Long And Prosper*Y

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      try use , FileInfo Property for a process. and for Exe file , just give the file name only, no need to give .exe. Thanks

      Best Regards ----------------- Abhijit Jana "Success is Journey it's not a destination"

      1 Reply Last reply
      0
      • F False Chicken

        Is there any way to start programs from the same folder as your C# program without getting a file not found exception? the only way I can seem to fix it is to put the other files into the root of C:\ and telling the program System.Diagnostics.Process.Start(@"C:\example.exe");. But the problem is I have an installer that puts all the files into "C:\program files\Random Title here". And that folder is what ever the user wants it to be, so I cant make my program predict that so just typeing System.Diagnostics.Process.Start(@"Example.exe"); gives me a file not found Exception unless i tell it to always install it "C:\". Any advice?

        Y*Live Long And Prosper*Y

        G Offline
        G Offline
        Gareth H
        wrote on last edited by
        #3

        False Chicken, http://msdn.microsoft.com/en-us/library/aa457089.aspx[^] Regards, Gareth.

        1 Reply Last reply
        0
        • F False Chicken

          Is there any way to start programs from the same folder as your C# program without getting a file not found exception? the only way I can seem to fix it is to put the other files into the root of C:\ and telling the program System.Diagnostics.Process.Start(@"C:\example.exe");. But the problem is I have an installer that puts all the files into "C:\program files\Random Title here". And that folder is what ever the user wants it to be, so I cant make my program predict that so just typeing System.Diagnostics.Process.Start(@"Example.exe"); gives me a file not found Exception unless i tell it to always install it "C:\". Any advice?

          Y*Live Long And Prosper*Y

          R Offline
          R Offline
          Reelix
          wrote on last edited by
          #4

          Try System.Diagnostics.Process.Start(Application.StartupPath + @"\Example.exe"); :)

          -= Reelix =-

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups