Kilroy
Kilroy

Reputation: 1

Is it possible to open multiple PDFs/the same multiple times from cmd line?

I'm attempting to create a simple script file (batch file) that will allow my organization to open multiple pdf documents at specified pages simultaneously. However, I can not seem to open the same pdf multiple times while running the script.

I have tried running the same script that would open the first document on a separate line with a different run command. I have also tried running a separate batch from the first in order to open the same document a second time with different parameters

@echo off
 cd..
  cd C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader
   start .\Acrord32.exe /A "page=2" "C:\Downloads\doc1.pdf"
   start .\Acrord32.exe /A "page=5" "C:\Downloads\doc2.pdf"
   start .\Acrord32.exe /A "page=3" "C:\Downloads\doc1.pdf"
exit

I expected pdf file "doc1" to open twice but with different start parameters. The first instance would open at page 2, and the second would open at page 3. However, only the first instance of doc1 is ever opened. doc2 opens without consequence at it's expected location.

Upvotes: 0

Views: 711

Answers (1)

user6811411
user6811411

Reputation:

  • Use the /N argument from the 2nd instance on, otherwise the 1st one will be reused.
  • Added a dummy pair of quotes for the window title
  • inserted Timeout just to recognize difference when used without /N´
:: Q:\Test\2019\08\29\SO_57715301.cmd
@Echo on
Set "AcroRD=C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe"
if not exist "%AcroRD%" (Echo can't locate "%AcroRD%" & Pause&Exit /B 0)

PushD "C:\Downloads\"

start "" "%AcroRD%" /A    "page=2"  "doc1.pdf"
timeout /T 5
start "" "%AcroRD%" /A /N "page=5"  "doc2.pdf"
timeout /T 5
start "" "%AcroRD%" /N /A "page=3"  "doc1.pdf"

Upvotes: 1

Related Questions