"Your time is limited, so don't waste it living someone else's life"

Detect default browser and launch in NSIS

Window supports us with a function to get any default executable application of a file. So we will get the default browser by create a empty *.htm file then get it’s default executable program, and that is also the default browser

    FileOpen $0 "$PLUGINSDIR\dummy.htm" "w"
    FileClose $0
    System::Call "Shell32::FindExecutable(t '$PLUGINSDIR\dummy.htm', i 0, t .r1)"
    Exec '"$1" http://google.com'

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: