launch default app (for file type) with arguments

Hi all,

I've been trying to get this to work, but haven't found a decent solution yet. What I need is to open a pdf file, in a maximized window, at a certain page. From the command line, it looks like this:

<path to acrord32.exe> /A page=N "<path to pdf file>"

However, I don't know the location of acrord32.exe on the client machine, so I use the pdf file as the parameter to run by Process.Start. The problem is that I cannot pass command line arguments anymore... Anyone has any idea on how to do this

Thanks in advance,
Cosmin.


Answer this question

launch default app (for file type) with arguments

  • Cesar Francisco

     cosminb wrote:
    it's actally the same as:

    Process.Start(filename, args);

    That would be correct.

    It seems acrobat doesn't support arguments if you are calling the file directly.

    This seems to be a good resource http://www.experts-exchange.com/Web/Graphics/Adobe_Acrobat/Q_21152136.html qid=21152136#12198372

    Looks like you'll have to look in the registry for the path to the PDF viewer and put the file path in the arguments as you were originally going to do.


  • hipswich

    Doesn't work, it's actally the same as:

    Process.Start(filename, args);

  • JLucio

    Hmm... there has to be a better way. That's alot of work just to find out the default app for a filetype. Maybe an MVP can shed some light on this matter.

  • ShadowRayz

    Can you please post a working example I've tried with ProcessStartInfo, but couldn't get it to work. I've also tried using the 'open' verb, with the pdf as the Filename, and passing the Arguments... No luck so far...

    Thanks,
    Cosmin.

  • azbluesky

    Process p = new Process();

    ProcessStartInfo psi = new ProcessStartInfo();

    psi.FileName = //...

    psi.Arguments = //...

    p.StartInfo = psi;

    p.Start();


  • vgta

    Process.StartInfo
  • launch default app (for file type) with arguments