Linux

Open Windows .URL links in Ubuntu

If you have used Windows and have dragged a URL to your desktop, it will have created a .URL file for you. Double click on this and that URL will open in FireFox. However, this does not work in Linux. In order to get a .URL file to open up in Linux we need a little trickery.

First create a file

sudo vim /bin/open_windows_url.sh

Add these contents and save

#!/usr/bin/perl

# Open up the file
open(F,"<$ARGV[0]") or die "$0: Could not load Internet Shortcut file $ARGV[0]!\n";

# Find the URL
while($in =  and not $url) {
    chop($in);
    if($in =~ m/\s*URL\s*\=\s*\S*\s*\015*/) {
        $url = $in;
        $url =~ s/\s*URL\s*\=\s*//; # Filter out the beginning stuff
        $url =~ s/\s*\015+//; # Filter out the nasty DOS carriage return!
    }
}

Now changer some permissions.

sudo chmod a+x /bin/open_windows_url.sh

and you are ready to go. In the Files browser, find and double click on a .URL. Choose open with other application and navigate to this file you have created. Click on the “Always Open with this Application” option.

Leave a Reply