How to Copy as Path Without Quotes or in File URI Format

When using the built-in Copy as Path context menu option or the Copy Path ribbon button to copy file names to clipboard, the output would contain quotes for file/folder name paths, such as below.

copy as path without quotes and in URI format

There are some situations where you don’t need quotes whether the file names contain spaces or not. To accomplish that, you can add your own Copy as Path option using a custom script and access it from the Send To menu.

Copy Path without Quotes

I made a script that does that, making use of the excellent NirCmd, multi-purpose command-line automation tool. Optionally, the script can also be modified to copy file paths in URI format if required.

  1. Download NirCmd from Nirsoft.net and extract NirCmd.exe to your Windows folder.
  2. Download the copy_as_path.vbs VBScript shown below.
  3. Move the script to a permanent location such as C:\Windows or anywhere you prefer.
  4. Double-click the script so that it adds a shortcut to the Send To folder automatically. You need to do this only for the first time.
  5. Now, select the files/folders, click Send To and click Copy as Path
    copy as path without quotes and in URI format
    This copies the file/folder paths to Clipboard without quotes.
    copy as path without quotes and in URI format

How to Copy Paths in URI format?

You can choose to copy file paths in URI format like the one below.

file:///C:/Program%20Files/Common%20Files

To do so, edit the script file (.vbs) using Notepad and change the following line:

CopyAsURI = 0

as below:

CopyAsURI = 1

And save the script file.



copy as path without quotes and in URI format

Select the files/folders, click Send To and click Copy as Path. File/folder paths would now be copied in URI format.

copyaspath-uri-5

I hope you find these scripts useful and productive. Let’s know your comments.


One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support. It won't take more than 10 seconds of your time. The share buttons are right below. :)

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a consecutive ten-time recipient of the Microsoft Most Valuable Professional award in the Windows Shell/Desktop Experience category, from 2003 to 2012. He loves to troubleshoot and write about Windows. Ramesh founded Winhelponline.com in 2005.

4 thoughts on “How to Copy as Path Without Quotes or in File URI Format”

  1. https://www.winhelponline.com/blog/copy-as-path-without-quotes-file-uri-format/

    ‘To copy file names in URI format, change the following value to 1
    Dim CopyAsURI
    CopyAsURI = 1 <— change 1 to 0 for this article

    The copy of the script copy_as_path.vbs posted in the blog link above has CopyAsURI set to 1 (URI format) when it should be set to 0 if the user is trying to follow your steps 1-5 to generate paths without quotes as discussed in this article.

    Note: The copy on github is the setup for URI format but specifically says so in the description.

    Reply
  2. Hi I am using the free program “Custom Context Menu” from the Microsoft store in order to try and get the copy path to show up on the main context menu instead of the expanded context menu. Is it at all possible with this script to do that?

    Reply

Leave a Comment