Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7901807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:19:45+00:00 2026-06-03T09:19:45+00:00

I have the following code in a batch file that is called by a

  • 0

I have the following code in a batch file that is called by a PHP script using shell_exec():

"C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe" 
/t "D:\xampp\htdocs\instrument\app\webroot\Repair Tickets\%1.pdf"
\\hnurenfp01\Accounts_FS-1128MFP

Parameter %1 is the filename that is sent as an argument to the batch file from the PHP script.

Observed behaviour:

  • PHP page successfully calls batch file with correct argument
  • Two instances of AcroRd32.exe silently start on the server
  • PDF file prints to network printer
  • AcroRd32.exe instances do not end/close
  • Batch file keeps running (until manually ending AcroRd32.exe processes)
  • PHP script is left executing, therefore preventing the client machine to do anything further

Expected behaviour:

  • PHP page successfully calls batch file with correct argument
  • Two instances of AcroRd32.exe silently start on the server
  • PDF file prints to network printer
  • AcroRd32.exe instances end/close
  • Batch script completes (which in turn should free up the PHP script)
  • PHP script continues and eventually ending to allow end-users to continue with their work

Failed solutions:

  • Using TASKKILL in the batch file to end AcroRd32.exe processes after print, but AcroRd32.exe remains open, even using the /F (force) flag. When I manually end the AcroRd32.exe processes, the batch file continues and then executes the TASKKILL line, which of course return a “process can’t be found” error because it’s no longer there. So it would seem the control is not returned back to the batch file after the print, it remains with AcroRd32.exe.

Does anyone have any ideas how I can close Adobe Reader after the PDF prints?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T09:19:46+00:00Added an answer on June 3, 2026 at 9:19 am

    I found the following quote at http://www.robvanderwoude.com/commandlineswitches.php#Acrobat

    Print a PDF file silently:

    AcroRd32.exe /N /T PdfFile PrinterName [ PrinterDriver [ PrinterPort ] ]
    The last command will open a new Adobe Reader window, print the PDF file and then terminate
    its window unless that window happens to be the only Adobe Reader window left: at least one Adobe Reader window will be left open.

    That last sentence is bad news.

    You could call AcroRD32.exe with both /N and /T options via the START command, and then your batch file can continue on immediately while the print job executes. If you don’t mind one instance of the reader remaining open, then you are done.

    If you must close the reader, then your batch will have to kill it. But I’m not sure how your batch file can tell when the print job has finished. You could introduce an arbitrary delay using TIMEOUT, but that sounds risky.

    I’m a bit confused about the “two instances of AcroRd32.exe” being opened. If that is the way the program works, then it sounds like the /N switch will close 1 of the 2 instances. Your batch could launch the print job via START, delay a couple seconds to give the print job processes time to start, and then use TASKLIST|FINDSTR to monitor the number of AcroRd32.exe processes in a loop. When the count goes from 2 to 1, the print job should be complete and you can kill the remaining process. In theory anyway 🙂

    Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a batch file with the following code: for /f tokens=* %%a in
I have the following script that I want the production guys to execute using
I want to write a batch file that performs the following operations: Check if
Reference Iterating arrays in a batch file I have the following: for /f "tokens=1"
i have the following code in batch (cmd): for /f delims= %%f in ('dir
I have a batch file to execute a VB script. While executing the batch
We have the following batch script: ( echo @release.sql echo exit ) | sqlplus
I have the following problem. I got a bat file that runs testcomplete test.
I have unzipped the sonar(code review tool) and started by executing batch file on
I have the following code to import a delimited file into an Access 2003

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.