Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am looking for a Windows utility that can copy the currently selected filename, including the path, to the clipboard, ideally through the right-click menu.

Some degree of flexibility would be useful, like the ability to copy just the filename, path+filename, filename minus extension, etc. This isn't essential, though, as long as it can copy the path+filename.

It must be compatible with Windows XP, Windows Vista and Windows 7.

Free and/or open source would be ideal.

share|improve this question
3  
Vista and higher have integrated way to do this: hold shift, open context menu on selected files. There will be item called "Copy as path" –  LogicDaemon Dec 1 '13 at 7:01

14 Answers 14

up vote 6 down vote accepted

Use CopyFilenames

or

Copy Filenames to Clipboard Utility

Windows has no way to copy a list of filenames to the clipboard. A Microsoft Knowledge Base article suggests writing a small *.bat file that runs the DIR command, collects its output into a file, prints that file, then deletes it. This may be convenient some times, but it would be more useful to be able to select a list of files, and have the names of them put on the clipboard. Then you could paste them wherever you needed them.

So here's a utility to do that. You have to do a bit of work yourself - but not much - to install it. Here are the instructions:

  1. Download the executable. It's only 20 KB, so it should take only seconds even if you're using dial-up access. Save it wherever you want it to reside on your system.
  2. Create a Shortcut in "Go To"

    1. Go to the "Send To" folder under your name in \Windows\Profiles in Windows Explorer (or maybe XP Home puts that directory under the Settings folder, I can't remember).
    2. Right-click in the right-hand pane, where the filenames are. Select "New|Shortcut".
    3. The "Create Shortcut" wizard will appear. On the first page, type in the path to the executable, or use the "Browse..." button to find it. Click ""Next".
    4. On the second page, type in a name for your new menu option. I used "File Names to Clipboard", but pick whatever will be meaningful to you. Click "Finish"

That's it; you've got it installed. Now select one or more files, right-click, and move your mouse pointer to "Send To". A submenu will appear which will include your new command. Choose that command, and a list of the files you've selected, sorted in ascending order, will be on the clipboard.

Source: http://members.cox.net/slatteryt/FNtoClip.html

share|improve this answer
1  
Serious drawback of that program: It cannot handle Unicode filenames. Using a small batch file that just pipes command-line arguments to clip.exe (included in recent Windows versions, previously available in the resource kit) should probably work better here (provided you use TrueType fonts for the console). –  Joey Jan 25 '11 at 13:30

Beginning with Vista you can just Shift+Right click on the file in Explorer and select "Copy as path":

        "Copy as path" context menu entry in Windows 7

This even works for multiple files, which are put into the clipboard one per line.

In Windows 8 this is exposed in the Explorer ribbon:

        "Copy path" button in the Windows 8 Explorer ribbon on the Home tab

share|improve this answer
4  
Awesome, this should totally be the accepted answer. No software required! –  HaggleLad Oct 15 '12 at 10:31
4  
Excellent, makes me wonder how I could be using Windows so long and not know this one. Bonus for working on multiple files. –  Bratch Dec 11 '12 at 15:40
    
Awesome, it is very useful. Thank you. –  Darshak Mar 18 at 7:18
1  
@HaggleLad the reason why this isn't the accepted answer is because of this line in the original question: "Must be compatible with XP, Vista and Win7". –  Charles Roper Jun 26 at 10:35

I use the MS 'Send to X' PowerToy available as part of the Windows 95 PowerToys set (MS download link).
This adds 'Clipboard as Name' (as well as 'Clipboard as Contents' and a few other options) to the right-click 'Send To' menu.
The easiest way to install is to extract the downloaded W95powertoy.exe with a Zip utility, rightclick 'SENDTOX.INF' and select 'Install'. You can remove any unwanted items from the 'Send To' menu by opening it in Explorer.

Works fine on Windows XP - not on Windows 7, but as noted by Johannes, you can use 'Shift + right-click' instead.

share|improve this answer

I use Ninotech Path Copy. Their website is dead, but it can be found here.

There's 14 different possibilities for copying file names, 5 of which you can fully customize.

share|improve this answer
    
+1 for PathCopy; this tool is particularly useful if, for example, you need to convert the path to forward slashes, or if you just need the path without the filename. –  yalestar Aug 19 '09 at 12:56
    
Excellent, just what I was looking for, they provide a 64bit DLL so I suppose it works on Win7 (will try at home...). The customization capabilities seems powerful (including a search/replace facility!). –  PhiLho Mar 29 '11 at 9:43

Send To toys

share|improve this answer
    
This is one of the most epic win utility. –  Chris Marisic Jul 15 '11 at 13:47
1  
Anonymous editor says that: > when downloading version 2.6, Antivirus claims this file contains a trojan/virus, Version 2.5 seems to be fine. –  slhck Aug 3 '11 at 10:35

Filemenu tools can do this plus a bunch of other useful stuff.

share|improve this answer

Some of us don't have the liberty to download/install/compile C++ at work so here's a download-free, install-free, code-free solution. I only tested this with Windows XP SP3:

  • Open the command prompt.
  • Dir the directory where the files you want to list are situated.
  • Right-click anywhere on the command prompt's window and chose "select all".
  • Hit the [enter] key (this will effectively copy the output of the command prompt to your clipboard).
  • Paste your clipboard's content where you want (I recommend Excel so that you can "text to columns" and make it a proper table).
share|improve this answer

For anyone still using Windows XP (like me, forced to at work), the following procedure works to copy a single filename without any additional software:

  1. Right click desired file in Windows Explorer list

  2. Click "Properties" in drop-down menu

  3. Highlight filename in box at top of "General" tab

  4. CTRL-C to copy filename then close "Properties" window

  5. CTRL-V to paste filename where you want it.

share|improve this answer

FreeCommander provides following 3 options after highlighting files:

  1. Copy full name as text
  2. Copy name as text
  3. Copy full path as text
share|improve this answer

Here is my open source solution and also free, if you consider Windows free :)

Create a batch file, say, listfiles.bat. Put either of the following into the file:

FILENAMES

set mylist=myfilelist.txt
set tempfile=tmp.txt
set diroptions=/a /b

set fullpath=%1
for %%i in (%fullpath%) do set path=%%~dpi
cd %path%

if exist %mylist% del %mylist%
if exist %tempfile% del %tempfile%

dir %diroptions% > "%path%%mylist%"

for /f "usebackq delims=" %%a in ("%mylist%") do (
if not "%%a"=="%mylist%" (
echo %%a >> %tempfile%
)
)

del %mylist%
ren %tempfile% %mylist%

PATH AND FILENAMES

set mylist=myfileandpathlist.txt
set tempfile=tmp.txt
set diroptions=/a /b /s

set fullpath=%1
for %%i in (%fullpath%) do set path=%%~dpi
cd %path%

if exist %mylist% del %mylist%
if exist %tempfile% del %tempfile%

dir %diroptions% > "%path%%mylist%"

for /f "usebackq delims=" %%a in ("%mylist%") do (
if not "%%a"=="%path%%mylist%" (
echo %%a >> %tempfile%
)
)

del %mylist%
ren %tempfile% %mylist%

Now create a shortcut to that file in C:\Documents and Settings\<username>\SendTo directory. Go to the directory you want to get a list of files from. Right click on any file and choose Send To -> Shortcut to listfiles.bat. The list of files will be written to myfilelist.txt or myfileandpathlist.txt depending on your choice. Obviously there is nothing stopping you from having shortcuts to both batch files in the SendTo directory.

For the full list of dir switches type dir /? on the command line or visit this website.

share|improve this answer

Here is simple AutoHotkey script, which copies all command line arguments to clipboard (separated by newlines). As with other solutions, it works via Send To menu, so put shortcut for it to "%USERPROFILE%\SendTo" (or it will do this for you if launched w/o arguments).

To run it, paste to notepad, and save to "%USERPROFILE%\SendTo\CopyToClipboard.ahk". Also you will need AutoHotkey 1.1 (direct dl) installed, it's FOSS.

#NoEnv
#NoTrayIcon
#SingleInstance force

If %0%
{
    Loop %0%  ; For each parameter:
        AllArguments .= ( A_Index > 0 ? "`r`n" : "") . %A_Index%
    ;MsgBox %AllArguments%
    Clipboard = %AllArguments%
    ToolTip Copied paths: %0%
} Else {
    MsgBox 68, %A_ScriptName%, This script copies command line arguments to clipboard. Intended to be used as Send To target`, so shourtcut to one should be in Send To.`n`nCreate the shourtcut?
    IfMsgBox Yes
    {
        EnvGet UserProfile, UserProfile
        FileCreateShortcut %A_AhkPath%, %UserProfile%\SendTo\Names to Clipboard.lnk,, %A_ScriptFullPath%, Copies file names (with paths) to clipboard.
    }
}

Sleep 1500
share|improve this answer

I like ClipboardPath by Stefan Bertels. Most of the other tools hide this away in the Send To submenu, which I rarely use; ClipboardPath positions it near the top of the context menu, and if you want the complete network path (very useful), just hold down Control before you select Copy path..

share|improve this answer

I wrote a little free/opensource .NET App called fnamecopy to do this very thing. It's very simple and doesn't have right click integration, you just drag the file(s)/folders you want the path for to a small window and then you choose which ones you want the path for. It's very bare bones, but it gets the job done for me.

share|improve this answer

StExBar gives you some flexibility and customizability in copying filenames, paths, etc. plus various additional features.

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.