by Greg Shultz
In this edition of the Windows Desktop Report, I'll show you how to PushD and PopD for temporary drive mapping. As I do, I'll explain how these two old DOS utilities work.
As you can see using Windows Explorer's network drive mapping feature really isn't that complex but it does require a multitude of steps. This is especially apparent when you see how quickly the same operation can be performed using the PushD/PopD commands.
Basically, the PushD/PopD commands are used to maintain a history list of directory paths in what is called a directory stack. In addition, these commands function like the Change Directory (CD) command.
The syntax for the PushD command is:
pushd [path]
When you use it, the PushD command stores the current path in the directory stack and then immediately changes to the specified path. When you use the PopD command, it retrieves the path at the top of the stack and changes to that path.
For example, if you are currently in the C:\Users\Greg\Documents directory and you type the command:
pushd c:\users\public
Then the C:\Users\Greg\Documents path is stored in the directory stack and the current directory becomes C:\Users\Public. When you are done working in the C:\Users\Public directory, you just type:
popd
When you do, the C:\Users\Greg\Documents path is retrieved from the directory stack and the current directory becomes C:\Users\Greg\Documents.
pushd \\Server\Share\path
Where \\Server\Share\path is the network resource to which you want to map a drive letter. As soon as you use it, the PushD command will instantly map a drive letter to the network resource and then change to that drive right in the Command Prompt window. When you're done, just type PopD and the mapped drive letter will be disconnected and you'll return to your original drive.
Keep in mind that, the PushD command allocates drive letters from Z: on down and will use the first unused drive letter that it finds.
In Windows 7, the Map network drive command appears on the Command Bar.
Have you ever needed to temporarily map a drive letter to a network location for a quick file operation while you are working from a command prompt? Of course, you can switch over to Windows Explorer and use the Map Network Drive command. While that is a viable solution, it requires multiple steps to create and then you have to perform several more steps to disconnect the network drive. This can be a pain - especially when you're working from a Command Prompt. Fortunately, you can use a pair of often overlooked Command Line tools still available in Microsoft Windows 7, PushD and PopD, to quickly map network drives.In this edition of the Windows Desktop Report, I'll show you how to PushD and PopD for temporary drive mapping. As I do, I'll explain how these two old DOS utilities work.
The Map Network Drive command
Just for the sake of comparison, let's begin by taking a look at all the steps involved in temporarily mapping a network drive in Windows Explorer. When you need to map a network drive from within Windows Explorer you can pull down the Tools menu and select the Map network drive command. If you are running Windows 7 with its context sensitive Command Bar, when you open Computer, the Map network drive command appears on the Command Bar.If you have connected to the drive before, you can find the network path on the Folder drop down
When you see the Map Network Drive window you use the Drive drop down to select a drive letter. Then, you can use the Folder drop down to select a drive you've previously mapped or click the Browse button and use the Browse For Folder dialog box to locate the network folder that you want to map to a drive. Be sure to leave the Reconnect at logon check box unselected.To disconnect, just select the icon and click OK
When you are done using the drive, you must then return to Windows Explorer, pull down the tools menu and then select the Disconnect network drive command. When you see the Disconnect Network Drive dialog box just select the drive icon and click OK.As you can see using Windows Explorer's network drive mapping feature really isn't that complex but it does require a multitude of steps. This is especially apparent when you see how quickly the same operation can be performed using the PushD/PopD commands.
The PushD and PopD commands in action
The PushD/PopD commands
As you may know, the PushD and PopD commands have been around since Windows 2000 and are quite powerful little commands that can save you quite a bit of time when you are working on the command prompt. However, they are often overlooked.Basically, the PushD/PopD commands are used to maintain a history list of directory paths in what is called a directory stack. In addition, these commands function like the Change Directory (CD) command.
The syntax for the PushD command is:
pushd [path]
When you use it, the PushD command stores the current path in the directory stack and then immediately changes to the specified path. When you use the PopD command, it retrieves the path at the top of the stack and changes to that path.
For example, if you are currently in the C:\Users\Greg\Documents directory and you type the command:
pushd c:\users\public
Then the C:\Users\Greg\Documents path is stored in the directory stack and the current directory becomes C:\Users\Public. When you are done working in the C:\Users\Public directory, you just type:
popd
When you do, the C:\Users\Greg\Documents path is retrieved from the directory stack and the current directory becomes C:\Users\Greg\Documents.
Mapping a network drive with the PushD and PopD commands is a piece of cake
Mapping network drives
In addition to making it easy to change back and forth between directories, the PushD and PopD commands also work with network paths. When working with network paths, the syntax for the PushD command is:pushd \\Server\Share\path
Where \\Server\Share\path is the network resource to which you want to map a drive letter. As soon as you use it, the PushD command will instantly map a drive letter to the network resource and then change to that drive right in the Command Prompt window. When you're done, just type PopD and the mapped drive letter will be disconnected and you'll return to your original drive.
Keep in mind that, the PushD command allocates drive letters from Z: on down and will use the first unused drive letter that it finds.
0 komentar:
Posting Komentar