Microsoft

Use the Copy as Path command to compensate for the missing drag and drop feature

If you’re like most IT folks, you use the command line to perform all kinds of tasks. However, there is one drawback to working from the command line that is exacerbated by long folder names -- changing from one folder, or directory, to another using the CD (Change Directory) command. In this edition of the Windows Vista Report, Greg Shultz shows you how to use the Copy as Path command as a replacement for the old drag and drop operation to save you some keystrokes when you are working in the command line.

If you're like most IT folks, you use the command line to perform all kinds of tasks. However, there is one drawback to working from the command line that is exacerbated by long folder names — changing from one folder, or directory, to another using the CD (Change Directory) command. Not only is typing long folder names on the command line a lot of extra work, but one typo and you'll find yourself starting all over.

In this edition of the Windows Vista Report, I'll show you how to use the Copy as Path command as a replacement for the old drag and drop operation to save you some keystrokes when you are working in the command line.

If it ain't broke...

When long file and folders names were introduced back in the days of Windows 95, Microsoft introduced two methods that were designed to simplify working with long folder names from the command line.

The first method involved using a drag and drop operation in which you could drag a folder icon from Windows Explorer and drop it in a Command Prompt window in which you had already typed the CD command followed by a double quote ("). You could then just press [Enter] and you were in business. The second method involved installing and using a Power Toy called Open Command Prompt Here, with which you could right click on any folder and open a Command Prompt window in that folder.

As you may know, both the native drag and drop operation and separately installed Open Command Prompt Here Power Toy have been available in every Windows operating system since then — until Windows Vista that is. Now, the renamed Open Command Window Here feature is built right into the operating system, which is definitely a plus; however, the drag and drop operation was 86ed. If you attempt to drag a folder from Windows Explorer and drop it in a Command Prompt window in Windows Vista, you'll see a Not Allowed symbol, similar to the one shown in Figure A.

Figure A

In Windows Vista dragging a folder and dropping it in a Command Prompt window is no longer allowed.

If, like me, you really got used to using drag and drop in a Command Prompt window, you found this omission in Windows Vista to be quite shocking the first time you encountered it. A handy feature that has been around for 12 years and five versions of Windows no longer works!

While I've not been able to find definitive answer on why Microsoft trashed the handy drag and drop operation, I have made due by taking advantage of the built-in Open Command Prompt Here feature. While not as slick, it does allow you to access deeply nested folders from the command line without having to type a lengthy path.

However, while recently using the Open Command Prompt Here feature, I was pining away for the drag and drop operation, when I discovered that a practical replacement was staring me right in the face the whole time — hidden in plain sight. Of course, I'm talking about the Copy as Path command.

The Copy as Path command

The Copy as Path command appears on the context menu when you hold down the [Shift] key as you right click on a folder, as shown in Figure B. Keep in mind that this [Shift] + Right-Click combination only works when you use it in the right hand section of Windows Explorer — it doesn't work in the Folders section on the left.

Figure B

You can access the Copy as Path command from the context menu when you use [Shift] + Right-Click combination in the main section of Windows Explorer.
Once you use the Copy as Path command, the entire path of the folder is copied to the clipboard. You can now select the Command Prompt window, type the CD command, press [Spacebar], and then right click anywhere inside the Command Prompt window. When you do, the entire path, already enclosed in double quotes is pasted on the command line, as shown in Figure C. You can then just press [Enter] and you instantly have access to that folder on the command line.

Figure C

Just right click in the Command Prompt window, and the path will be pasted on the command line.

While it may seem that this technique isn't as slick as the old drag and drop operation, I must admit that once you get used to it, it is every bit as fast as the old method. And, in many cases, it is a better alternative than using the Open Command Prompt Here feature.

Other uses

While the using the Copy as Path command is a handy aid when working in a Command Prompt window, it has other uses too. For example, suppose you need to send a link to a network share to a colleague via e-mail. All you have to do use the Copy as Path command, paste the path in the e-mail, and you have an instant shortcut that you can then send to your colleague. And, in addition to using the Copy as Path command to copy the path to a folder or network share, you can also copy the path to a file — including the file name.

Another place the Copy as Path command comes in handy is when uploading files to a Web site. Instead of using browse dialog box to locate the file you want to upload, you can simply paste the path into the upload text box.

About

Greg Shultz is a freelance Technical Writer. Previously, he has worked as Documentation Specialist in the software industry, a Technical Support Specialist in educational industry, and a Technical Journalist in the computer publishing industry.

Editor's Picks