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 to open File using System.Diagnostics.Start in the Base Root directory

How to open File using System.Diagnostics.Start in the Base Root directory

Scheduled Pinned Locked Moved C#
helpdebuggingtutorial
6 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.
  • N Offline
    N Offline
    nassimnastaran
    wrote on last edited by
    #1

    Hi All ! I have a pdf file, place in the debug directory (in any drive) . I want to open this file with any full path :

    string appPath = Path.GetDirectoryName(Application.ExecutablePath);
    Process.Start(appPath + "\\Debug\\HelpFile.pdf");

    But I have an error that can not file file , pl z help me ! thanks in advance !

    L L 2 Replies Last reply
    0
    • N nassimnastaran

      Hi All ! I have a pdf file, place in the debug directory (in any drive) . I want to open this file with any full path :

      string appPath = Path.GetDirectoryName(Application.ExecutablePath);
      Process.Start(appPath + "\\Debug\\HelpFile.pdf");

      But I have an error that can not file file , pl z help me ! thanks in advance !

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Put a break point on the second line and see what the path is... To me it looks like you are trying to go into the debug folder from your run folder. Usually the "Debug" folder is where you are running from when using VS so you have an extra folder in the path.... P.S. Don't use text speak in forums. It is rude.

      Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

      N 1 Reply Last reply
      0
      • L Lost User

        Put a break point on the second line and see what the path is... To me it looks like you are trying to go into the debug folder from your run folder. Usually the "Debug" folder is where you are running from when using VS so you have an extra folder in the path.... P.S. Don't use text speak in forums. It is rude.

        Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

        N Offline
        N Offline
        nassimnastaran
        wrote on last edited by
        #3

        @"..\Debug\HelpFile.pdf"); It's works ! Thanks in advance! Regards !

        D 1 Reply Last reply
        0
        • N nassimnastaran

          @"..\Debug\HelpFile.pdf"); It's works ! Thanks in advance! Regards !

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Yeah, but when you deploy the application in production, it'll fail! Unless you have the Debug folder created when you install the application, BOOM!

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak

          1 Reply Last reply
          0
          • N nassimnastaran

            Hi All ! I have a pdf file, place in the debug directory (in any drive) . I want to open this file with any full path :

            string appPath = Path.GetDirectoryName(Application.ExecutablePath);
            Process.Start(appPath + "\\Debug\\HelpFile.pdf");

            But I have an error that can not file file , pl z help me ! thanks in advance !

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            I suggest you read Windows Special Folders[^]. :)

            Luc Pattyn [My Articles] Nil Volentibus Arduum

            N 1 Reply Last reply
            0
            • L Luc Pattyn

              I suggest you read Windows Special Folders[^]. :)

              Luc Pattyn [My Articles] Nil Volentibus Arduum

              N Offline
              N Offline
              nassimnastaran
              wrote on last edited by
              #6

              thanx ! ;)

              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