Map a drive while in the Command Prompt

If you have ever tried to switch to a UNC name while working with the Command Prompt, you have found that it can cause you a problem. What you need is a mapped drive to the UNC path. Using pushd, you can accomplish this. pushd will map to the last available drive (i.e. Z:) and automatically switch you to that drive mapping. Here's the syntax:
  • pushd \\server\share\path
    For example, \\mycompanyserver\commonfiles\project1
Of course when you're done, you may want to unmap that drive. No problem, use popd. With popd, it will switch you back to the path you were on and unmap the drive letter. Here's the syntax:
  • popd z
This is a great solution for those batch files that require a drive mapping, but you do not want to keep the mapping alive all the time.

Comments

Popular posts from this blog

Digital Signatures in PDF Do Not Print

Referencing the value of a cell, not its formula

Active window loses focus