Friday, March 16, 2007

An enhanced version of ChDir (or CD) command

Thanks for Raymond Chen's recent blog message on changing directory to UNC path name, I have now discovered that the pushd is actually an enhanced version of XP's cd or Chdir command.

Often people wants to change to a directory on another drive and often people discovers that nothing happens because the person has forgotten to include the /d switch like this:

C:\Windows>cd /d d:\temp

Instead of doing this clumsy way, why not simply replace your cd command with pushd, like this:

C:\Windows>pushd d:\temp

This command essentially performs this command:
pushd . & cd /d d:\temp

The added bonus of using pushd to change directory is that you can use popd to return to your original folder.

Great idea and is extremely useful to create user friendly batch file.

No comments:

Post a Comment