10 Jul 2011

Drag and Drop to Command Prompt – It’s Back in Windows 7!

Working with the Command Prompt is one of an IT Professional's required skills. In previous Windows operating systems, one could drag and object to an open Command Prompt window in order to ease our work. This feature was nice to have especially when running executable files nested deep within a folder hierarchy. Instead of manually navigating the Command Prompt path to the required folder, you could simply drag and drop the necessary file to the Run option or to the Command Prompt and press Enter to run it.

Somehow, this useful feature wend away in Windows Vista and Windows Server 2008. I wrote about this in my Missing Drag and Drop in Vista Command Prompt article. In Vista/2008, if you try to drag a file from anywhere in Windows Explorer to an open Command Prompt window you see that the pointer icon changes to a "no entry" symbol:

drag_and_drop_cmd_2008

When asked, Microsoft officials provided dull answers and claimed that this is "by design" and that it was in fact "a feature". Some claimed that "This was done to reduce the command window's dealings with the dragged data object". This last excuse is, in my opinion, pure crap especially when compared to the huge overhead provided by other so-called "advanced" features of Vista such as the process-intensive Aero theme (read my Aero Theme is bad, disable it article or to the huge overhead of the TCP Window Auto tuning functionality that wrecks havoc to your network copy and browse functions (read my Browsing websites and downloading files is painfully slow with Windows Vista. Other answers included things like "you can shift-right-click to get the copy as path function instead" (read my Quickly Copy File and Folder Path in Windows Vista. Another claim was that the drag and drop feature was dropped because it poses a "security risk". Maybe, I don't know, but since it's been present since the days of older operating systems I don't see why it wasn't removed before if it was such a huge security risk.

You can imagine that I did not have high expectations set when I booted up my Windows 7 (currently beta build 7000) virtual machine and fired a CMD window. I tried dragging a file name onto the open CMD window, and behold, it works!

drag_and_drop_win7_1

drag_and_drop_win7_2

drag_and_drop_win7_3

Other methods worth mentioning are also listed in my How can I quickly copy a file or a folder's path in Windows Vista? article which describes a trick that still works in Windows 7;

Open a Windows Explorer windows, browse to the required file. Hold the SHIFT key while you right-click the folder.

drag_and_drop_win7_4

You can now paste the copied path anywhere you want, including to a Command Prompt window.

drag_and_drop_win7_5


No comments:

Post a Comment