3

In Windows XP I'm very used to being able to drag a folder or file (from Windows Explorer) onto a command prompt and have it paste there the full path to that folder or file (including quotes if needed).

I can't get this to work in Windows Vista/Server 2008 (I've not tried Windows 7). Can this be fixed?

5 Answers 5

3

Somehow, this useful feature went away in Windows Vista and Windows Server 2008, but has come back in Windows 7.

A possible workaround is using Send To Toys, which adds the "Send To Command Prompt" . It opens a CMD window, setting the current directory to the selected folder. If the selection was a file, the folder containing the file will be the active directory and the name of the file will be typed for you at the prompt. Hold down the CTRL key to change the active directory to a different folder. Hold down the SHIFT key to force the use of the COMMAND.COM regardless of the Windows version.

The only other solution is to hold shift when right-clicking on a file, which gets you the "Copy as path" option, which you can then paste into the command prompt.

EDIT
I found DropCommand which enables you to drag files easily into your Vista command prompt screen. I haven't tested it though.

5
  • DropCommand is exactly what i was looking for - its a bit glitchy in that you need to pause your mouse for a second before the command prompt window accepts the drag / drop, but it does the job.
    – Justin
    Oct 9, 2009 at 17:27
  • The DropCommand website seems to be gone.
    – Uwe Keim
    Feb 5, 2017 at 15:40
  • 1
    @UweKeim: The donationcoder.com website seems to be down at the moment. DropCommand is still available on the Wayback Machine.
    – harrymc
    Feb 5, 2017 at 15:50
  • Thanks! Starting the setup under Windows 10 seems to have no effect.
    – Uwe Keim
    Feb 5, 2017 at 16:05
  • 1
    @UweKeim: This post is tagged for Vista. From Windows 7 and onward this option is already available. If it doesn't work for you, you could post the problem on our forum.
    – harrymc
    Feb 5, 2017 at 16:23
2

You can simply open your folder, hold the Shift key, and select File in the menu bar - you'll have Open command window here.

For files, hold the Shift key and right click the file, select copy as path. Return to your Command Prompt, right click and "Paste".

Or simply by using DropCommand:

alt text

1
  • no need to select File menu. Either Shift+Right click, Shift+Menu key, Shift+F10 will work. So does Alt+D > cmd > enter
    – phuclv
    Apr 30, 2018 at 13:38
1

It works fine for me, if it does not work for you, this is probably a UAC issue.

If you launch a regular command prompt, drag and drop works. The moment I elevate the command prompt, I loose this ability as explorer runs in a lower security context than the command prompt.

I have tried to elevate Explorer, but it does not seem to work and short of terminating explorer and relaunching as a admin process, I do not know of any other way around it. (and not sure that this would work)

0

Yes this is a UAC issue as @WilliamHilsum says, but I have seen that if you enable the Built-in Administrator account and log in it, then launch a Command prompt there, you can drag on drop files on both elevated or non-elevated command prormpts.

0

I have made a small registry hack for this:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\CopyFilePath]
"MUIVerb"="Copy File Path..."
"Icon"="imageres.dll,-5357"
"Position"="Bottom"

[HKEY_CLASSES_ROOT\*\shell\CopyFilePath\command]
@="cmd.exe /c (echo.|set /p=\"%1\") | clip"

[HKEY_CLASSES_ROOT\Directory\shell\CopyFolderPath]
"MUIVerb"="Copy Folder Path..."
"Icon"="imageres.dll,-5357"
"Position"="Bottom"

[HKEY_CLASSES_ROOT\Directory\shell\CopyFolderPath\command]
@="cmd.exe /c (echo.|set /p=\"%1\") | clip"

Save it as a .reg file and merge to the registry.

It will add "Copy file path" to file context menu and "Copy folder path" to folder context menu (at bottom). You can right click Files and click those buttons to copy their file paths and paste at the command prompt.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .