problems with process.start methode
-
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.
-
Hi, What if you try:
System.Diagnostics.Process.Start("C:\\Program Files\\Acrobate\\Reader 8.0\\AcroRd32.exe", "\"C:\\sourcedir\\somefile.pdf\"");
Mika
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?
-
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?
-
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.exeyeap, this is a typo, sorry. the correct path is C:\\Program Files\\Acrobate\\Reader 8.0\\AcroRd32.exe in every example.
-
yeap, this is a typo, sorry. the correct path is C:\\Program Files\\Acrobate\\Reader 8.0\\AcroRd32.exe in every example.
-
nope, it's just a typo in here!
-
nope, it's just a typo in here!
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
-
yeap, this is a typo, sorry. the correct path is C:\\Program Files\\Acrobate\\Reader 8.0\\AcroRd32.exe in every example.
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:
-
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:
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:
-
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:
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\"");
-
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\"");
So is it working now? :) Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
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\"");
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 executeMika