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. problems with process.start methode

problems with process.start methode

Scheduled Pinned Locked Moved C#
helpquestion
13 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.
  • S stephan_007

    hy everyone! i do have some problems with the process.start() methode. i want to start the following command via the process.start()

    "C:\Program Files\Acrobate\Reader 8.0\Reader\AcroRd32.exe" /h /t "C:\sourcedir\somefile.pdf" "printer001"

    (sure it's not the correct syntax here, but it's readable this way) when i try to start this code in command line then it works fine, but when i add it to the process.start() methode, it either does nothing or it throws an exception "there is/are invalid path/s" I added full access to the sourcedir, so access problems shouldn't be the reason. when i just try to start acrobate as parameter (so e.g.

    System.Diagnostics.Process.Start("\"C:\\Program Files\\Acrobate\\Reader 8.0\\AcroRd32.exe\"");

    , it works and it start acrobate as a process. when i just add the file including the dirinfo e.g.

    System.Diagnostics.Process.Start("\"C:\\sourcedir\\somefile.pdf\"");

    , it accepts it as well. but it does not work using the whole string above. i also tried to use the startinfo object with all it's parameters, but it didn't work neither. does anyone of you have an idea? I don't think it's a problem because of access rules, because why would the acrobate start if there were some?? :sigh: thanks! stephan.

    W Offline
    W Offline
    Wendelius
    wrote on last edited by
    #2

    Hi, What if you try:

    System.Diagnostics.Process.Start("C:\\Program Files\\Acrobate\\Reader 8.0\\AcroRd32.exe", "\"C:\\sourcedir\\somefile.pdf\"");

    Mika

    S 1 Reply Last reply
    0
    • W Wendelius

      Hi, What if you try:

      System.Diagnostics.Process.Start("C:\\Program Files\\Acrobate\\Reader 8.0\\AcroRd32.exe", "\"C:\\sourcedir\\somefile.pdf\"");

      Mika

      S Offline
      S Offline
      stephan_007
      wrote on last edited by
      #3

      is there a difference in mering it to one string or to seperate it with a comma?? and is there a chance to get it start with the parameters and the printer this way?

      W 1 Reply Last reply
      0
      • S stephan_007

        is there a difference in mering it to one string or to seperate it with a comma?? and is there a chance to get it start with the parameters and the printer this way?

        W Offline
        W Offline
        Wendelius
        wrote on last edited by
        #4

        Just wondering is there a typo. Should there be folder Reader after Reader 8.0? Take a look at the paths you posted

        C:\Program Files\Acrobate\Reader 8.0\Reader\AcroRd32.exe
        C:\\Program Files\\Acrobate\\Reader 8.0\\AcroRd32.exe

        S 1 Reply Last reply
        0
        • W Wendelius

          Just wondering is there a typo. Should there be folder Reader after Reader 8.0? Take a look at the paths you posted

          C:\Program Files\Acrobate\Reader 8.0\Reader\AcroRd32.exe
          C:\\Program Files\\Acrobate\\Reader 8.0\\AcroRd32.exe

          S Offline
          S Offline
          stephan_007
          wrote on last edited by
          #5

          yeap, this is a typo, sorry. the correct path is C:\\Program Files\\Acrobate\\Reader 8.0\\AcroRd32.exe in every example.

          W M 2 Replies Last reply
          0
          • S stephan_007

            yeap, this is a typo, sorry. the correct path is C:\\Program Files\\Acrobate\\Reader 8.0\\AcroRd32.exe in every example.

            W Offline
            W Offline
            Wendelius
            wrote on last edited by
            #6

            No problem :) That solved the problem?

            S 1 Reply Last reply
            0
            • W Wendelius

              No problem :) That solved the problem?

              S Offline
              S Offline
              stephan_007
              wrote on last edited by
              #7

              nope, it's just a typo in here!

              W 1 Reply Last reply
              0
              • S stephan_007

                nope, it's just a typo in here!

                W Offline
                W Offline
                Wendelius
                wrote on last edited by
                #8

                Ok, next steps could be: - any info in stack of the exception - is the exception type of Win32Exception One possibility is usage rights as you mentioned. You could try to move the pdf to another place (for example temp where you would not have problems with rights) Another thing is that is it possible that Acrobat is actually giving the error and it's only reported through .net framework. I may be totally off the track at this time of the day (1 AM local time) and need to get some sleep, but I'll check on this again tomorrow Mika

                1 Reply Last reply
                0
                • S stephan_007

                  yeap, this is a typo, sorry. the correct path is C:\\Program Files\\Acrobate\\Reader 8.0\\AcroRd32.exe in every example.

                  M Offline
                  M Offline
                  Mark Salsbery
                  wrote on last edited by
                  #9

                  Acrobat really has the "e" on the end on your system? This worked fine for me:

                  System.Diagnostics.Process.Start("\"C:\\Program Files\\Adobe\\Reader 8.0\\Reader\\AcroRd32.exe\"", "");

                  Mark

                  Mark Salsbery Microsoft MVP - Visual C++ :java:

                  B 1 Reply Last reply
                  0
                  • M Mark Salsbery

                    Acrobat really has the "e" on the end on your system? This worked fine for me:

                    System.Diagnostics.Process.Start("\"C:\\Program Files\\Adobe\\Reader 8.0\\Reader\\AcroRd32.exe\"", "");

                    Mark

                    Mark Salsbery Microsoft MVP - Visual C++ :java:

                    B Offline
                    B Offline
                    blackjack2150
                    wrote on last edited by
                    #10

                    Mark Salsbery wrote:

                    Acrobat really has the "e" on the end on your system?

                    Aaaahhh, so that's why the 'methode' was not working. :doh:

                    S 1 Reply Last reply
                    0
                    • B blackjack2150

                      Mark Salsbery wrote:

                      Acrobat really has the "e" on the end on your system?

                      Aaaahhh, so that's why the 'methode' was not working. :doh:

                      S Offline
                      S Offline
                      stephan_007
                      wrote on last edited by
                      #11

                      it's just a typo. should have been adobe instead of acrobat :( sorry. if there are typos in the dirinfo then please ignore them. it's not the reason, because i copied the directory info from the file explorer to visual studio, so this info is correct. i guess when typing it here i mixed it up. so the correct path should be System.Diagnostics.Process.Start("\"C:\\Program Files\\Adobe\\Reader 8.0\\Reader\\AcroRd32.exe\"", "\"C:\\sourcedir\\somefile.pdf\"");

                      M W 2 Replies Last reply
                      0
                      • S stephan_007

                        it's just a typo. should have been adobe instead of acrobat :( sorry. if there are typos in the dirinfo then please ignore them. it's not the reason, because i copied the directory info from the file explorer to visual studio, so this info is correct. i guess when typing it here i mixed it up. so the correct path should be System.Diagnostics.Process.Start("\"C:\\Program Files\\Adobe\\Reader 8.0\\Reader\\AcroRd32.exe\"", "\"C:\\sourcedir\\somefile.pdf\"");

                        M Offline
                        M Offline
                        Mark Salsbery
                        wrote on last edited by
                        #12

                        So is it working now? :) Mark

                        Mark Salsbery Microsoft MVP - Visual C++ :java:

                        1 Reply Last reply
                        0
                        • S stephan_007

                          it's just a typo. should have been adobe instead of acrobat :( sorry. if there are typos in the dirinfo then please ignore them. it's not the reason, because i copied the directory info from the file explorer to visual studio, so this info is correct. i guess when typing it here i mixed it up. so the correct path should be System.Diagnostics.Process.Start("\"C:\\Program Files\\Adobe\\Reader 8.0\\Reader\\AcroRd32.exe\"", "\"C:\\sourcedir\\somefile.pdf\"");

                          W Offline
                          W Offline
                          Wendelius
                          wrote on last edited by
                          #13

                          You could test one thing just in case: - define both parameters as string and assign them - put the string to clipboard - paste the text to command prompt and execute it If the pdf is opening, it's clear that the command is valid. For example:

                          string filename = "\"C:\\Program Files\\Adobe\\Reader 8.0\\Reader\\AcroRd32.exe\"";
                          string arguments = "\"C:\\sourcedir\\somefile.pdf\"";
                          Clipboard.Clear();
                          Clipboard.SetText(filename + " " + arguments);
                          System.Diagnostics.Process.Start(filename, arguments);
                          //paste to command prompt and execute

                          Mika

                          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