How to edit Windows .url files

As a one time thing, here is an easy way:

  1. Open a Windows "Command Prompt"
  2. Navigate to the folder containing the ".URL" file that you want to edit.
    For this example, let's say your ".URL" file is named "Example.url"
  3. Rename the file to add a ".txt" extension.
    C:\>ren "Example.url" "Example.url.txt"
  4. Leave the "Command Prompt" window open for later.
  5. Edit the file in the usual way you would edit a ".txt" file, using your favorite text editor.
  6. Return to the open "Command Prompt" window.
  7. Rename the file back as it was, by removing the ".txt" extension.
    C:\>ren "Example.url.txt" "Example.url"


If you will be editing .URL files more often, you can add "Notepad.exe", or your favorite text editor, to the "context-menu" you see when you "Right Click" on any ".URL" file.

To do this, you will need to make some simple modifications to your registry. There are a few ways to do this. Here are 2 of them...

Method 1:

Create a ".reg" file with the necessary information and use "regedit.exe" to "import" the ".reg" file.

First, create a new text document and edit it with your favorite text editor. Copy and paste the following into the file:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\IE.AssocFile.URL\Shell\Open URL as Text]
@="Open with Notepad"

[HKEY_CLASSES_ROOT\IE.AssocFile.URL\Shell\Open URL as Text\Command]
@="C:\\Windows\\System32\\Notepad.exe %1"

The above is configured to use "Notepad.exe" as the editor that will be run when you use your new "context-menu" item to edit a ".URL" file. If you want to use a different text editor, make these changes to the above new text document before you save it:

  1. The part that says @="Open with Notepad" defines what will show up in the "context-menu" when you "Right Click" on a ".URL" file. You can change it to whatever "title" you want by changing "Open with Notepad" to "Whatever you want".
  2. The part that says @="C:\\Windows\\System32\\Notepad.exe %1" defines the program that will be run when you use your new "context-menu" item to edit a ".URL" file. You can change it to use your favorite text editor by changing "C:\\Windows\\System32\\Notepad.exe" to the path and name of your desired text editor. Note that you need to double the backslashes ("\") in your path like \\ as shown. Don't forget to leave the "space" and "%1" at the end.

If using "Notepad" is OK with you, then you can leave the file as shown above.

From your text editor, save the new ".reg" file you created. As an example, you could save it as "EditURLfile.reg".

Next, run "Regedit". It will normally be located here: "C:\Windows\regedit.exe".

From within "Regedit", click the menu item: File -> Import, and navigate to select the select the new ".reg" file you created ("EditURLfile.reg") and click OK.

You can now close "Regedit". Now, when you "Right Click" on any ".URL" file, you should see a new item in the "context-menu" to open (edit) the file.


Method 2:

If you are not comfortable using "Regedit" to add the "context-menu", you can do it directly from the Windows "Command Prompt". You will be pasting the following 2 lines into the Windows "Command Prompt":

reg add "HKCR\IE.AssocFile.URL\Shell\Open URL as Text" /t REG_SZ /d "Open with Notepad"
reg add "HKCR\IE.AssocFile.URL\Shell\Open URL as Text\Command" /t REG_SZ /d "C:\Windows\System32\Notepad.exe %1"

The above is configured to use "Notepad.exe". If you want to use a different text editor, make these changes to the 2 lines above.

  1. The part that says "Open with Notepad": Change this to whatever "title" you want for the new "context-menu" item.
  2. The part that says "C:\Windows\System32\Notepad.exe %1": Change this to specify the path and name of your desired text editor. Note that for this method, you need single backslashes ("\") in your path as shown. As above, don't forget to leave the "space" and "%1" at the end.

If using "Notepad" is OK with you, then you can leave the 2 lines as shown above.

  1. Open a Windows "Command Prompt"
    Depending on the "Policies" setup on your computer, you may have to open the "Command Prompt" as "Administrator" ("Right Click" on "cmd.exe" and select . "Run as Administrator").
  2. Paste the above 2 lines (one at a time) into the "Command Prompt" window.
    For each line you paste, you should get a confirmation message displayed:
    The operation completed successfully.

Now, when you "Right Click" on any ".URL" file, you should see a new item in the "context-menu" to open (edit) the file.