Possible Duplicate:
Can windows command line support Linux “cd -”?
Under Linux, I can use cd -
to return to the last directory. How can I do that on Windows?
Possible Duplicate:
Can windows command line support Linux “cd -”?
Under Linux, I can use cd -
to return to the last directory. How can I do that on Windows?
You can use the pushd and popd commands.
pushd <dir>
will change directory from location a to location bpopd
will change directory back to directory aExample:
pushd %TEMP% // go to user's temp dir, and remember
pushd \Windows // go to windows dir, and remember
popd // go back one dir, in this case the temp dir
popd // go back one more dir, in this where you were before temp
cd..
works, thanks to @Акула (below answer)
Jul 6, 2017 at 6:14
cd ..
goes one directory up. pushd/popd
can be used to remember and go back the previous directory that you were at. It is often used in batch files where you want to remember the directory the user was at before starting the batch file, so you can return to it when you finish.
Cmd.exe is an emulation layer for the old MS-DOS, commands are the same :
For the others look at some Ms-Dos table around the web
cd -
as a command returns you to /a/b/c/d, whereas cd ..
moves you to /a/e and cd /
moves you to /.
cd /
is valid. Just not when you use it with pushd
, for some odd reason. But I agree it is not an answer to the question.