PUSHD – Windows CMD Command
Notice: A non well formed numeric value encountered in /home/future4tech/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118
Notice: A non well formed numeric value encountered in /home/future4tech/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119
Notice: A non well formed numeric value encountered in /home/future4tech/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118
Notice: A non well formed numeric value encountered in /home/future4tech/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119
Notice: A non well formed numeric value encountered in /home/future4tech/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118
Notice: A non well formed numeric value encountered in /home/future4tech/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119
Change the current directory/folder and store the previous folder/path for use by the POPD command.
1 2 3 4 5 6 7 8 |
Syntax PUSHD [drive]path PUSHD Key drive The drive to switch to path The folder to make 'current' (UNC names accepted) |
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
1 2 3 4 5 6 7 |
Batch files When PUSHD is used in a batch script it is strongly recommended that you check the %errorlevel% to be sure that the directory exists and was successfully connected before continuing: PUSHD \\install_server\wsus_share :: If this fails then exit If %errorlevel% NEQ 0 goto:eof :: other commands... |
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.
Errorlevels
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
1 2 3 4 5 6 7 |
Examples C:\demo> pushd \work C:\work> popd C:\demo> pushd "F:\monthly reports" F:\monthly reports> popd C:\demo> |
PUSHD is an internal command. If Command Extensions are disabled the PUSHD command will not accept a network (UNC) path.
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
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
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
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
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
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