go back to where we came from – pushd popd

For those few who still write dos batch file, a couple of invaluable commands are pushd and popd. Many a time, we need to change the folder within a script and then go back to the previous folder. Pushd and Popd enable you to do just that. For. e.g. say you started your command shell using the ‘cmd’ command line, it opens up in the default location.  Now instead of changing directories using the ‘cd’ command, you change them using ‘pushd’. This causes the folder to be pushed on to the folder history stack. You can then quickly go to top folder in the stack using ‘popd’. The following screenshot illustrates this


Another slick feature of ‘pushd’ is the ability to temporarily map a network folder to a local drive. A temporary drive letter is allocated to the network folder. This drive letter is then deleted when the corresponding ‘pop’ is done.



About 925coder

Father. Husband. Programmer. In that order. I love writing code, in all languages, all platforms. In my day job I am the lead architect in a software company creating products for the finance industry, mostly using Microsoft .NET technologies.

Posted on September 20, 2009, in Tech. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: