July 31st, 2004

Using pushd to get to network paths

Buck Hodges
Director of Engineering

A short while ago I saw someone at the office use pushd to cd into a network path.  I’ve used pushd/popd on Windows for some time, but I never thought to try it on a network path or actually read the help for it.  Pushd will actually map the path to a drive letter automatically and then take you there.  The latter part is expected, but mapping the drive is really cool.  Maybe it should be obvious (how else would the command line do it?), but it wasn’t to me.  It’s a lot more convenient than “net use“ or anything else that I know of.

C:\>pushd /?
Stores the current directory for use by the POPD command, then
changes to the specified directory.
PUSHD [path | ..]
  path        Specifies the directory to make the current directory.
If Command Extensions are enabled the PUSHD command accepts
network paths in addition to the normal drive letter and path.
If a network path is specified, PUSHD will create a temporary
drive letter that points to that specified network resource and
then change the current drive and directory, using the newly
defined drive letter.  Temporary drive letters are allocated from
Z: on down, using the first unused drive letter found.

Topics
Random

Author

Buck Hodges
Director of Engineering

Director of Engineering, Azure DevOps

0 comments