Just came up with this VBS.
If WScript.arguments.count > 0 Then
Dim WshShell: Set WshShell = WScript.CreateObject("Wscript.Shell")
strPath = "file:///" & Wscript.Arguments(0)
strPath = Replace(strPath,"\","/")
strPath = Replace(strPath," ","%20")
sCmd = "%comspec% /c<nul (set/p anyvariable=" & Chr(34) & strPath & Chr(34) & ")|clip.exe"
WshShell.Run sCmd,0,0
Set WshShell = Nothing
End If
Save it as a .VBS file. Drag and drop a file on to the VBScript and it copies the file's URI to clipboard. You can implement it in the right-click menu if required.
It copies the file name to memory, reverses the slashes, replaces spaces with "%20", and appends "file:///" at the beginning. It's a basic script which supports only one file name / argument. You can modify it as required.
Add the Script to your Send To folder
You may place a shortcut of the script in your Send To folder. Press WinKey + R, type shell:sendto
and press ENTER. Create a shortcut to the script in the Send To folder and name it accordingly. (eg. Copy File URI
)
Now, right-click a file, click Send To and click Copy File URI
. The file path would be copied to the clipboard, in the URI format as below.
file:///C:/Users/jack/desktop/list-of-items.txt