Copy full file path in Windows XP

I've often the need to copy the full file path of a file or directory from the file explorer in Windows - is there any easy way of doing this ?


Solution 1:

In explorer go to tools - folder options and on the view tab choose display full path in the address bar. You can then copy and paste from the address bar.

Solution 2:

You can drag and drop the file on the run dialog, or on a command prompt, this will put the full path at the cursor position.

Alternatively, you can install something like Ninotech Path Copy so you have it in your default explorer context menu:

Ninotech Path Copy is a shell extension for Windows 95, 98, NT4, 2000, and XP that enables to copy the path of a file or directory to the Clipboard. You can then paste the path in to your document, e-mail, etc. You copy the path of a file or directory by right-clicking it in the Windows Explorer and choosing Copy Path from the context menu. The context menu then offers nine standard ways of copying the path, in addition to the user defined copying methods that you create yourself:

Of course, what Col suggests is maybe even easier?

Solution 3:

Copy and paste this text into Notepad and save with a .reg extension:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Allfilesystemobjects\shell\CopyPath]
@="Copy as Path"
"Extended"=""

[HKEY_CLASSES_ROOT\Allfilesystemobjects\shell\CopyPath\command]
@=hex(2):25,00,63,00,6f,00,6d,00,73,00,70,00,65,00,63,00,25,00,20,00,2f,00,63,\
  00,20,00,65,00,63,00,68,00,6f,00,20,00,22,00,25,00,31,00,22,00,7c,00,63,00,\
  6c,00,69,00,70,00,2e,00,65,00,78,00,65,00,00,00

Double click the .reg file, add to the registry, then log off and back on again. Download Clip.exe from Microsoft's FTP site, and copy it to C:\Windows\System32. Now if you hold SHIFT and right-click on a file, you'll see the Copy as Path submenu item.

Solution 4:

Here is another solution for people who are in locked down corporate environments as it doesn't require an external executable or access to the registry.

Click on Start -> Run and then enter shell:sendto and press Enter. This will open up a folder. Create a file called Clipboard (full path and filename).vbs and put the following code into it:

Option Explicit
If WScript.Arguments.Count = 0 Then WScript.Quit
Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
Dim sFile : sFile = fso.GetAbsolutePathName(WScript.Arguments(0))
Dim sDrive : sDrive = fso.GetDriveName(WScript.Arguments(0))
Dim sMap : sMap = GetMappedDrive(sDrive)
If sMap <> "" And sDrive <> sMap Then sFile = Replace(sFile, sDrive, sMap)
Call CopyToClipboard(sFile)
Msgbox "The following path has been copied to the clipboard:" & VbCrLf & VbCrLf & sFile, 0 + 64 
Set fso = Nothing
WScript.Quit

Function GetMappedDrive(sDrive)
    Dim wshNetwork : Set wshNetwork = CreateObject("WScript.Network")
    Dim oDrives : Set oDrives = wshNetwork.EnumNetworkDrives
    Dim i
    For i = 0 to oDrives.Count - 1 Step 2
        If UCase(oDrives.Item(i)) = UCase(sDrive) Then
            GetMappedDrive = oDrives.Item(i+1)
            Exit For
        End If
    Next
    Set oDrives = Nothing
    Set wshNetwork = Nothing
End Function

Function CopyToClipboard(sText)
    ' Create temporary text file to avoid IE clipboard warnings
    Dim sTemp : sTemp = fso.GetSpecialFolder(2) & "\" & fso.GetTempName
    Dim oFile : Set oFile = fso.CreateTextFile(sTemp, True)
    oFile.Write "This file can be safely deleted"
    oFile.Close
    Set oFile = Nothing
    ' Start Internet Explorer in the local zone
    Dim oIE : Set oIE = CreateObject("InternetExplorer.Application")
    oIE.Visible = 0
    oIE.Navigate2 sTemp
    Do
        WScript.Sleep 100
    Loop Until oIE.Document.ReadyState = "complete"
    ' Copy contents to clipboard
    oIE.Document.ParentWindow.ClipboardData.SetData "text", sText
    ' Clean up
    fso.DeleteFile sTemp
    Set oIE = Nothing
    Set fso = Nothing
End Function

When you want to get the full path of a file or folder, right click on the item and then select Send to -> Clipboard (full path and filename).vbs.

A pop-up will appear telling you the full path and it will also be copied to the clipboard ready for pasting into another application or document.