Advertisement

[Tip] Paste a file or folder path to the command prompt quickly

There are times when you need to paste a file or folder path to the Windows command prompt. You might be doing several mouse clicks or typing for this simple task. It is possible to optimize this simple operation and reduce the amount of clicks.

Advertisement

In general, you may frequently need:

  • to copy the full path to a file using the Ribbon or context menu in File Explorer in Windows 8.
  • and to right click the command prompt's window title and choose Edit -> paste command from its context menu or right click the black input area and choose the Paste command from there. Even if you have "Quick Edit" mode, where a simple right click pastes the clipboard's contents, there is a faster way.

Not so many people seem to be aware that it is possible to drag the desired file or folder directly to the command prompt window to paste it's path into the command prompt. This is extremely handy if you need to paste the path of the several files or repeat this task for many objects one by one.

Just select some file or folder in File Explorer and drag it to the opened command prompt. In the example below, I did that with the "Program Files" folder:

cmd drag drop
As you can see from the screenshot above, the full path of that folder had been added to the command line. This works in Windows XP, Windows 7 and Windows 8/8.1 (but not Vista).

Note: In case the drag and drop to the Windows command prompt does not work, it may be because of the fact that you opened an elevated command prompt. Elevated command prompt runs at a higher integrity level and lower integrity processes can't communicate with it. In that case, you will not be able to drop files there from File Explorer. To get it working, you need to run your file manager app also elevated. In that case, you can use some alternative file manager tool, or make Windows File Explorer to run as administrator on Windows 8.1, Windows 8 and Windows 7.

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Advertisment

Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

3 thoughts on “[Tip] Paste a file or folder path to the command prompt quickly”

  1. Paste a file or folder path to the command prompt quickly ?
    Select the file you want to copy the fully qualified name,
    Ctrl-C (yes, exactly like if you are to copy the file),
    Alt-tab up to the command prompt window,
    Be sure that the mouse pointer is anywhere over the command prompt window,
    Right-click the mouse. (OK, this part is longer but to do it faster, just keep the mouse near the keyboard).

  2. Thank you for this post! Most simply say “it can’t be done”. Mysteriously, I was able to do this with an Administrator prompt on Win7, but it stubbornly won’t do so in Win10. Below is a keyboard workaround which is pretty fast, IF you have a keyboard with what’s known as the Context key, which causes the same behavior as a right-mouseclick (I think most keyboards have this by now). It is located between the right Windows key and right CTRL key.

    Have the file whose name you want to copy highlighted in an Explorer window (by single left-mouseclicking the name). Press Shift and while holding it, press the Context key, then release both Shift and Context, then press A. You can then paste into the new Win10 command prompt by pressing CTRL-V or right-mouseclicking.

Leave a Reply

Your email address will not be published.

css.php
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.