PDF Security & Access Issues

Open a Password-Protected PDF from a Windows Batch File

Muhammad TalhaMuhammad Talha Nov 19, 2026 870 views

Question details

The user wants to open a password-protected PDF from a Windows batch file without exposing the document password.

Open a Password-Protected PDF from a Windows Batch File
Product
Password-protected PDF and Windows batch files
Device & OS
Windows
Scenario
Launching a protected PDF from a batch file, potentially as part of an automated workflow.
Observed behavior
Adobe applications do not provide a standard Windows batch command for securely passing the PDF password as an argument.
Before you start

Confirm that you know the PDF's opening password and that your default PDF viewer can open protected files. If the workflow must run unattended, check which PDF tools and credential stores your organization permits.

Solution 1Recommended

Launch the PDF from a batch file and enter the password

Use this method when someone can enter the password interactively; the password does not need to appear in the batch file.

1
Create the batch file

Open Notepad and enter a command such as start "" "C:\Documents\protected.pdf", replacing the example path with the full path to your PDF.

2
Save the file

Select File > Save As, choose All Files as the file type, and save the file with a .bat extension, such as open-pdf.bat.

3
Open the PDF

Double-click the batch file in File Explorer. Windows opens the PDF in the default application associated with PDF files.

4
Enter the password

When the PDF viewer prompts you, enter the document's opening password. If the default viewer cannot open protected PDFs, choose a compatible viewer in Windows default app settings.

Launch the PDF from a batch file and enter the password
Interactive password entry: This method opens the file but does not supply the password automatically. The password prompt requires user interaction.
Open protected PDFs

Open a password-protected PDF in WPS Office

WPS Office can open a protected PDF when you enter its password in the viewer. This is an interactive alternative, not a secure unattended batch-password solution.

  1. 1. Launch WPS Office: Open WPS Office on your Windows computer.
  2. 2. Select the PDF: Choose Open and browse to the password-protected PDF.
  3. 3. Enter the password: Type the document's opening password when prompted and confirm to open the PDF.
Open a protected PDF and enter its password in the viewerKeep the PDF password out of a batch file when opening it interactivelyWork with Microsoft Office formats, including Word, Excel, and PowerPoint filesUse a familiar interface for PDFs and office documents
microsoft office alternative - wps office

Frequently Asked Questions

Can a batch file open a protected PDF without storing its password?

Yes. Use start "" "C:\path\file.pdf" to launch the PDF in the default viewer, then enter the password at the viewer's prompt.

Can I pass the PDF password as a command-line argument?

Some third-party tools may accept a password argument, but arguments can be exposed to other processes or logs. For unattended workflows, use an approved tool with a supported protected credential-input method instead.

Why does the batch file open the wrong PDF viewer?

The start command uses the Windows default app associated with PDF files. Change the PDF default app in Windows settings, then run the batch file again.

Can WPS Office automatically supply the password from my batch file?

The WPS method described here requires you to enter the password in the viewer. For unattended password handling, use an approved PDF utility or API with supported secure credential access.