PUSHD – Windows CMD Command

Change the current directory/folder and store the previous folder/path for use by the POPD command.

If the drive is not specified, the current drive will be assumed.
If neither drive nor path is specified PUSHD will just display a list of previous pathnames, you can switch back to any of these by using POPD one or more times.
The number of pushed directories can be displayed on the command line with PROMPT $+
If the path specified does not exist, PUSHD will return %errorlevel% =1

Run as Admin

When a batch script is ‘Run as Admin’, the current directory will be set to C:\windows\system32\.
Using the following pushd command at the start of the script will restore the normal current directory.

This works by setting the current directory to the location of the batch script, using the %0 parameter

pushd “%~dp0”

UNC Network paths

When a UNC path is specified, PUSHD will create a temporary drive map and will then use that new drive.
The temporary drive letters are allocated in reverse alphabetical order, so if Z: is free it will be used first.


If the Current directory was changed: %ERRORLEVEL% = 0
If the Directory does not exist or is not accessible or if a bad switch is given: %ERRORLEVEL% = 1

PUSHD is an internal command. If Command Extensions are disabled the PUSHD command will not accept a network (UNC) path.

You may also like...

6 Responses

  1. 0mniartist says:

    Hey there! I just wanted to ask if you ever have any problems with hackers?
    My last blog (wordpress) was hacked and I ended up losing a few months of hard work due to
    no backup. Do you have any solutions to protect against hackers?
    0mniartist asmr

  2. 0mniartist says:

    Hello there! Quick question that’s completely
    off topic. Do you know how to make your site mobile friendly?
    My weblog looks weird when viewing from my apple iphone.
    I’m trying to find a template or plugin that might be
    able to resolve this issue. If you have any recommendations,
    please share. Many thanks! 0mniartist asmr

  3. 0mniartist says:

    I have read so many articles or reviews concerning the blogger lovers but this piece of writing is in fact a pleasant paragraph, keep it up.
    0mniartist asmr

  4. 0mniartist says:

    Greate pieces. Keep writing such kind of info on your page.
    Im really impressed by your site.
    Hi there, You’ve performed an incredible job. I’ll definitely digg it and individually recommend to my friends.
    I’m sure they will be benefited from this web site.
    0mniartist asmr

  5. 0mniartist says:

    This is very fascinating, You are an overly skilled
    blogger. I have joined your rss feed and sit up for looking for more of your wonderful post.
    Also, I have shared your web site in my social networks asmr 0mniartist

  6. zortilo nrel says:

    I believe this is one of the so much vital information for me. And i’m satisfied studying your article. But wanna commentary on some common issues, The website style is wonderful, the articles is really nice : D. Just right task, cheers

Leave a Reply

Your email address will not be published. Required fields are marked *