How do I create a .url file on OS X?

Add these lines in TextEdit and save as .Url

[InternetShortcut]
URL=http://www.yourfavweb.com/
IconIndex=0

Following Kirk's answer, here is an small bash script for creating such files. Executing

url-create.sh superuser-site http://superuser.com/

creates a file superuser-site.url:

[InternetShortcut]
URL=http://superuser.com/

The url-create.sh shell script is the following:

#!/bin/bash
if [[ $# -le 1 || $# -ge 3 ]] ; then
    echo Usage: $0 '<namefile> <url>'
    echo
    echo Creates '<namefile>.url'.
    echo Openning '<namefile>.url' in Finder, under OSX, will open '<url>' in the default browser.
    exit 1
fi

file="$1.url"
url=$2
echo '[InternetShortcut]' > "$file"
echo -n 'URL=' >> "$file"
echo $url >> "$file"
#echo 'IconIndex=0' >> "$file"

PS: I don't think the IconIndex is necessary, so I commented it out.


It is sufficient to put

URL=http://www.yourfavweb.com/

in the file to make it work, the [InternetShortcut] and IconIndex seem not to be necessary (any more?).

Tags:

Macos

Url