'PushD' is a windows command which stores the current directory for use by the PopD command, and then changes to the specified directory.
Questions tagged [pushd]
32 questions
13
votes
1 answer
Possible to use pushd/popd in Dockerfile?
Is there any way to use pushd/popd commands within a Dockerfile? It'd make some install scripts I have a lot easier if it were possible.

Austin
- 6,921
- 12
- 73
- 138
6
votes
1 answer
pushd does not go into specified directory
I am trying to go into a directory using pushd
#!/bin/bash
function cloneAll {
[ -d ~/mapTrials ] || mkdir ~/mapTrials
pushd '~/mapTrials/'
echo $(pwd)
popd
}
The echo $(pwd) gives me the same working directory that I called the…

leoOrion
- 1,833
- 2
- 26
- 52
5
votes
2 answers
bash: no need to call popd after pushd at the end of a script?
I was going through some trouble to do some proper "pushd/popd cleanup" in my bash script. That is: if I did pushd a few times, I wanted to make sure to do the same number of popd before exit.
However, I noticed that the pushd/popd stack doesn't…

RocketNuts
- 9,958
- 11
- 47
- 88
3
votes
3 answers
implicit "popd" on batch exit
Is there a way to undo all pushd at the end of script. What I have is:
pushd somwhere
rem doing stuff
goto end
:end
popd
goto :EOF
What I'd like to have is:
setlocal
pushd somwhere
rem doing stuff
goto :EOF
But that doesn't work, the directory…

ooLi
- 63
- 6
3
votes
1 answer
pushd not working in a batch file with delayed expansion
I have read many questions and answers about pushd here and on other sites, the overwhelming majority of them referring to issues with UNC paths. However, I've got a different problem I haven't seen a single hint about.
Using Windows 10 x64…

Binarus
- 4,005
- 3
- 25
- 41
3
votes
2 answers
Why does %CD% not work in a for loop with PushD
I want to run a .bat script which makes a file and save it with the same name as the folder it is in. I want it to start in a map and loop through the submaps.
I started with this code below and run it in one of the submaps. That works, I get a file…

Zanzi
- 35
- 4
3
votes
1 answer
Is there a way to workaround this pushd bug?
Despite it is not documented pushd accepts wildcards (when command extensions are turned on). But does not work as I expect and seems buggy. When a wildcard expression is passed pushd gets all files(!) and folders that apply the pattern in…

npocmaka
- 55,367
- 18
- 148
- 187
2
votes
2 answers
How to create an bash alias for the command "cd ~1"
In BASH, I use "pushd . " command to save the current directory on the stack.
After issuing this command in couple of different directories, I have multiple directories saved on the stack which I am able to see by issuing command "dirs".
For…

Rakesh
- 77
- 4
2
votes
2 answers
MS-Win-CMD PushD/PopD how it work and why not in a "For /f"-Loop
After I faild again and again to find the answer I wrote these Script: