#!/bin/bash # Copyright (c) 2016 Doug Henderson # Licence: GPL3 # Version: 1.0 # # openurl[.sh] [IE] URL # # Open a URL in the default browser or in Internet Explorer. # This will work properly when using CYGWIN_NOWINPATH=1 # Tested on Windows 7 Home Premium, Service Pack 1, fully patched # and CYGWIN_NT-6.1 xxx 2.6.1(0.305/5/3) 2016-12-16 11:55 x86_64 Cygwin # # You may rename this file to meet your requirements. # # Quote the URL when it contains spaces or shell special characters. # # Usage: # openurl.sh [IE] URL # # openurl.sh https://www.google.ca # open Google search with default browswer # # openurl.sh IE https://www.google.ca # open Google search with Internet Explorer # if [ -n "${COMSPEC}" -a -x "$( cygpath -Ua "${COMSPEC}" )" ] ; then # COMSPEC should contain the absolute windows path # to the CMD.EXE executable. CMD="${COMSPEC}" else # Hard code path to windows CMD.EXE # You may need to change this depending on windows version # and install options. # Copy/paste from CompSpec variable on Command Prompt window. # Double all backslashes. CMD="C:\\Windows\\System32\\cmd.exe" # echo WARNING: using hardcoded path: ${CMD} fi # Make sure we know location of Command program. if [ ! -x "$( cygpath -Ua "${CMD}" )" ] ; then echo ERROR: Please provide path to CMD.EXE exit 1 fi IE="C:\\Program Files\\Internet Explorer\\iexplore.exe" # echo WARNING: using hardcoded path: ${IE} # Hardcode the location of the Internet Explorer EXE file. # Copy/paste from Blue-E shortcut icon properties Target field. # Double all backslashes. if [ "$1" = "IE" ] ; then # Make sure we know location of Internet Explorer. if [ ! -x "$( cygpath -Ua "${IE}" )" ] ; then echo ERROR: Please provide path to IEXPLORE.EXE exit 1 fi shift "$( cygpath -Ua "${CMD}" )" /D /S /C "START /I "${IE}" "$*"" else "$( cygpath -Ua "${CMD}" )" /D /S /C "START /I "$*"" fi