How to Open a Local File After Scanning a QR Code on Windows
Question details
The user wants a local file (such as a PDF, Word, or Excel document) to launch automatically immediately after scanning a QR code containing the file's path.

- Product
- Windows
- Device & OS
- Windows
- Scenario
- Scanning a QR code that contains a local file path using a hardware barcode scanner while on the Windows desktop.
- Observed behavior
- The scanner outputs the path as plain text. The file only opens if the cursor is actively placed in an address bar (like File Explorer or Chrome); otherwise, the scan has no effect.
Ensure your barcode scanner is properly connected to your PC and configured as a keyboard wedge (outputting text data). Verify that the local file paths encoded in your QR codes are accurate and point to accessible files on your system.
Configure the Scanner Pre-amble and Post-amble Settings
Modify your barcode scanner's hardware settings to automatically trigger the Windows 'Run' dialog before typing the path, eliminating the need to click an address bar manually.
Most USB barcode scanners act as a virtual keyboard. By default, they type the QR code's text and press 'Enter'. Since Windows requires an application to receive this text, scanning on the desktop does nothing.
You can program the scanner to send a specific keyboard shortcut before it types the file path. By sending 'Win + R' (the Windows Run command) before the text, and 'Enter' after the text, Windows will automatically launch the file.
Find the physical or digital user manual for your specific barcode scanner brand and model. You will need to scan special configuration barcodes from this manual.
Find the section for 'Prefix' or 'Preamble' configuration. Scan the programming barcodes to set the prefix to the 'Windows Key + R' combination.
Find the section for 'Suffix' or 'Postamble' configuration. Scan the programming barcode to ensure the suffix is set to 'Enter' or 'Carriage Return' (CR).
Go to your Windows desktop and scan your QR code. The scanner should automatically open the Run dialog, paste the local file path (e.g., C:\Docs\file.pdf), and press Enter, launching the file instantly.

Use an Automation Utility like AutoHotkey
If you cannot reprogram your scanner, use a background script on Windows to detect scanner input and launch the file automatically.
Open Your Scanned Documents Seamlessly with WPS Office
Once you have configured your scanner to launch local files, you need a fast and reliable application to view them. WPS Office provides an all-in-one suite that handles PDFs, Word documents, and Excel spreadsheets in a single lightweight program, making document retrieval incredibly fast.
- 1. Download and Install: Download WPS Office for free from the official website and follow the installation prompts.
- 2. Set as Default Application: Go to Windows Settings > Apps > Default apps. Set WPS Office as the default application for .docx, .xlsx, and .pdf files so they open immediately when scanned.

Frequently Asked Questions
Why does my PC just beep when I scan a QR code on the Windows desktop?
A standard barcode scanner acts as a virtual keyboard. If you scan a code while on the desktop without an active text field (like an address bar or notepad), the PC receives keyboard strokes but has nowhere to type them, resulting in an error beep or no action being taken.
Can Windows natively open a file from a barcode scanner without extra configuration?
No. Windows treats standard scanner input purely as plain text. It requires an active application or an active text entry field (like the Run dialog or File Explorer address bar) to receive the text and act upon it.
How should I format the local file path in the QR code?
Ensure the QR code contains the absolute file path, such as 'C:\Users\Public\Documents\file.pdf'. It must be spelled exactly as it appears in Windows, including drive letters and backslashes, so the system can locate it when the path is executed.




