TL;DR
Get the latest gadgets delivered free with Prime
- Fast, free delivery on millions of items
- Prime Video, Amazon Music and more included
- Member-only deals all year
A customer’s program failed when launched by a batch file but worked when opened from Windows Explorer. The Old New Thing reports that changing to the program’s directory before running it fixed the problem, pointing to a difference in the current working directory.
A customer’s program showed an error when launched from a Windows batch file but worked when double-clicked in File Explorer; changing the batch file’s current directory fixed the problem, according to a report published by The Old New Thing on October 26, 2026. The case highlights that starting the same program by two methods can give it different working directories, which can affect how it finds related files.
The report says the customer initially asked for help writing a batch file to launch the program. The program was invoked by its full path, but the batch file did not first change the current directory to the program’s folder. The author suspected the application looked for ancillary files relative to the working directory rather than locating them from the executable’s own path.
In the reported case, the customer confirmed that explicitly changing directories resolved the error. They used pushd to enter the relevant directory and popd afterward to restore the prior directory. The report does not name the application or describe the error message, so the specific files or functions involved are not known.
The author also raised a second possibility that was not investigated: a program might register an App Paths entry requesting extra directories be added to the PATH environment variable when it is launched. The report says this did not become necessary to pursue after changing the directory fixed the issue.
Why the Launch Method Matters
The practical lesson is that a program’s launch location and working directory are not necessarily the same thing. A batch file can point directly to an executable while leaving the current directory elsewhere. If the program expects configuration, data, templates, or other supporting files in its working directory, it may fail even though the executable itself starts.
This distinction can help users and support teams avoid treating a launch-method problem as evidence that the program is broken or missing. It also matters when automating applications: a script should reproduce the directory and environment the application expects, rather than assuming that providing the full executable path is enough. The report documents one customer’s fix, not a universal explanation for every program that behaves differently when launched from a script.
Products Worth Considering

Jackery Explorer 300 Portable Power Station, 292Wh

Bose TV Speaker Compact Soundbar with Bluetooth and HDMI-ARC, Black

Logitech MX Keys S Wireless Keyboard, Graphite
As an affiliate, we earn on qualifying purchases.
Explorer and Batch File Directories
The Old New Thing’s report explains that, when a file is double-clicked in Explorer, Explorer sets the launched program’s current directory to the directory containing the selected item. The author says the same behavior applies when a user double-clicks an .exe file: its containing directory becomes the current directory. This can support applications that look for related files in that location.
A batch file does not necessarily reproduce that behavior just because it launches the executable using a full path. The working directory is a separate part of the process’s launch conditions. In the reported case, the customer’s use of pushd and popd addressed that difference by changing directories for the launch and then restoring the previous location.
“The customer confirmed that explicitly changing the directory fixed the program.”
— The Old New Thing report
What the Case Does Not Establish
The report does not identify the program, the error text, or which supporting files it needed. It therefore does not establish exactly what the application was trying to load, beyond the author’s explanation that it may have relied on files relative to its current directory. The customer’s successful directory change supports that diagnosis for this case, but other programs may fail from batch files for different reasons.
The possible App Paths and PATH issue remains untested in this incident. The report also does not specify the full batch-file command or the directory from which the script was run, so readers should not assume that the same change will solve every similar problem.
Check the Script’s Working Directory
For a similar failure, the next practical check is whether the batch file changes to the directory the program expects before launching it, and whether the application depends on files stored there. In the reported case, using pushd to change directories and popd to return afterward resolved the issue.
If matching the working directory does not help, the report’s author suggests checking whether the application uses an App Paths entry to add directories to PATH. The source describes that as a follow-up possibility, not as a confirmed cause in the customer’s case; other causes would require separate investigation.
Key Questions
Why can a program work when double-clicked but fail from a batch file?
The two launch methods can give the program different current directories. If it looks for supporting files relative to that directory, it may find them in Explorer but not when started by a batch file.
Does using the executable’s full path set the working directory?
Not necessarily. The report distinguishes the executable’s location from the process’s current directory; a batch file may need to change directories separately.
What fixed the problem in the reported case?
The customer changed directories before launching the program, using pushd, and then restored the previous directory with popd. The customer confirmed that this resolved the error.
Could another issue cause the same symptom?
Yes. The report mentions an App Paths entry that can add directories to PATH as another possibility, but says it was not investigated because the directory change fixed this case.
Source: devblogs.microsoft.com
