How to Open a PDF and Search for a Term from the Command Line
Question details
The user wants to launch a PDF reader from the Windows command prompt and automatically pass a search term to find specific information, such as invoice numbers connected to an XLSX file.

- Product
- PDF Reader / Adobe Acrobat
- Device & OS
- Windows
- Scenario
- Automating PDF document retrieval and keyword searching directly from a command prompt or batch script to match data.
- Observed behavior
- The user needs the application to open the designated PDF file and immediately display the search results pane for the specified term.
Ensure you have the exact file paths for both your PDF application executable and the target PDF file before running command-line scripts.
Use Command Line Parameters to Search
Utilize the specific parameter switch in the Windows command prompt to launch your PDF reader, open the document, and execute a search query simultaneously.
While you cannot force the application to automatically jump to the first highlighted word without manual interaction, you can open the Advanced Search window with your desired string pre-filled.
This method is highly useful for connecting external datasets, like invoice numbers from a spreadsheet, directly into a combined PDF document.
Press the Windows key on your keyboard, type 'cmd', and press Enter to launch the Command Prompt application.
Prepare your command using the syntax: "<Path to Acrobat.exe>" /A "search=<Search term>" "<Path to PDF file>".
Type or paste the formulated command into the prompt and press Enter. The application will launch, open your PDF, and display the search results pane.
Manually double-click the first match in the search results window to jump directly to its location within the document.

Search and Manage PDFs Effortlessly with WPS Office
WPS Office provides a lightweight, all-in-one platform for managing spreadsheets and PDFs. You can easily open combined PDFs and quickly search for invoice numbers or terms without complex command-line setups, making data matching between Excel and PDFs incredibly smooth.
- 1. Open Your PDF: Launch WPS Office and open your combined PDF document directly from the home interface.
- 2. Activate the Search Tool: Press 'Ctrl + F' on your keyboard to instantly open the Find dialog box.
- 3. Locate Your Term: Enter your invoice number or specific search term into the box and click 'Find Next' to jump straight to the text.

Frequently Asked Questions
Can the command line make the PDF jump directly to the text without clicking?
No, using the command-line search parameter generally opens the Advanced Search pane with the results populated. You will still need to manually double-click the result to jump to that specific page and highlight.
Why does the command prompt return an error saying the path cannot be found?
This typically occurs if there are spaces in your folder names (e.g., 'Program Files'). Ensure that both the executable path and the PDF file path are completely enclosed in double quotation marks.
Is it possible to search for a phrase containing multiple words?
Yes, you can include multiple words in your search. Simply enclose the entire phrase after the equals sign in quotes, such as: search="invoice number 12345".
Does this command line method work on macOS?
The specific '/A' command-line switch is designed for the Windows executable environment. macOS requires different terminal inputs, typically utilizing AppleScript or the built-in 'open' command with different application-specific flags.




