18

I would like to open a PDF in Photoshop from the command line. My current issue right now is that the default application for opening PDFs is Adobe Acrobat. I'm wondering if there is any parameter I can pass to specify which program to use when opening a file.

In other words, I want to emulate the option of "Open-with" when you right-click a file to open it with the non-default application, but from the command line.

I do not want to change the default application for PDFs to be Photoshop.

Any ideas?

4 Answers 4

29

All you need to is provide the filename as a command line argument:

photoshop <path to file>

(<path to file> needs to be quoted if it contains spaces)

For example:

photoshop "C:\Users\csterling\Documents\some document.pdf"

If the directory containing photoshop.exe isn't in your Path environment variable, you'll need to provide the full path:

"C:\Program Files\Adobe\Photoshop\photoshop" "C:\Users\csterling\Documents\some document.pdf"

This isn't a feature of the command prompt, it's a feature of the executable, i.e. photoshop.exe has to be programmed to accept a file to open as a command line argument. Fortunately, it is, as are the majority of Windows applications that operate on files.

2
  • Thanks for the reply. So this is a good idea, but when I type in >photoshop "path\to\file.pdf" it opens Photoshop, but does not open the pdf. Photoshop.exe is in my path environment variables. Have you successfully used this technique to open a PDF in Photoshop on your computer? Can you think of any reason as to why that command would open the software but not the PDF?
    – csterling
    May 2, 2013 at 21:00
  • @csterling specifying a valid path to file opens fine for me, photoshop will just open without opening the file if the path is not valid - so I would double check the path is correct
    – aland
    Jul 24, 2013 at 20:39
2

In case you want this to work with relative path in PowerShell, here is the script:

function photo
{
   $the_filename=resolve-path $args[0]
   photoshop $the_filename
}

Then you can just type:

cd C:\Users\csterling\Documents
photo mypic.jpg
1

You can do it by using the start command:

start <program-name> <file-path>

In your case, you would have to do something like this:

start photoshop D:\open.pdf
0

Unfortunately, the current version of Photoshop doesn't support this operation out of the box. You can open the program: start "path_to_photoshop.exe", but there is no way to pass it a file to open. If you really want to do it, you will need to get something like this: https://www.eulanda.eu/en/access-photoshop-api-via-powershell-script. Sorry, I wish I had a better answer, especially since I wanted to be able to do this for a program I was working on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.