Open a Password-Protected PDF from a Windows Batch File
Question details
The user wants to open a password-protected PDF from a Windows batch file without exposing the document password.

- 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.
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.
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.
Open Notepad and enter a command such as start "" "C:\Documents\protected.pdf", replacing the example path with the full path to your PDF.
Select File > Save As, choose All Files as the file type, and save the file with a .bat extension, such as open-pdf.bat.
Double-click the batch file in File Explorer. Windows opens the PDF in the default application associated with PDF files.
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.

Use an approved PDF tool with secure credential handling
Use this approach when the protected PDF must be processed without an interactive password prompt.
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. Launch WPS Office: Open WPS Office on your Windows computer.
- 2. Select the PDF: Choose Open and browse to the password-protected PDF.
- 3. Enter the password: Type the document's opening password when prompted and confirm to open the PDF.

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.




