💻 Software
Temporarily change directory for single batch-file command
Fresh7 days ago
Mar 15, 202630057 viewsConfidence Score0%
0%
Problem
In shell-scripting if I need to run a command from a directory I can us a subshell to ensure I return to the original context: Can this be done in Windows batch-files (or cmd-files) Doing the same in batch-files leaves me in the new directory. I can do: But the popd is dependent on the success of .…
Error Output
(cd temporary/new/directory ; command) # now I am still in original directory
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Canonical Fix
Unverified Fix
New Fix – Awaiting Verification
Fix for: Temporarily change directory for single batch-file command
Low Risk
By default, Windows batch files are run in the parent shell's context (which is unusual for Unix users, where an explicit is needed, but was the only possibility in MS-DOS). This means directory changes and environment variables affect the original …
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix