I want to create a batch file which creates a shortcut on the desktop or in the start menu.
The shortcut needs to open a webpage which is a local windows server ip address(like 'http:\192.168..*:81\').
I also want to provide a custom image icon to the shortcut.
I know this is an old thread but it was the first StackOverFlow page to popup in Google, so I thought I'd make a reply.
The following is a batch script that I use to manage URL shortcuts: (please note that this script assumes that an icon also exists - MyIconName.ico - in the same directory as this script. If an icon is not available or not required, simply omit the pertinent lines)
Please note also that any trailing spaces will affect the value of the variable...
@echo off
@echo.
@echo.
@echo.
::Set the application-specific string vars
SET AppDescription=MyAppName
SET IconName=MyIconName.ico
SET Shortcut_Name=MyShortcutName.url
SET URL_PATH=http://www.Google.com
::Set the common string vars
SET WORKING_PATH=%~dp0
SET ICONDEST=c:\ProgramData\%AppDescription%
SET LinkPath=%userprofile%\Desktop\%Shortcut_Name%
@echo. Copy Icon
IF EXIST "%ICONDEST%" (GOTO _CopyIcon)
mkdir "%ICONDEST%"
:_CopyIcon
copy "%WORKING_PATH%%IconName%" "%ICONDEST%"
echo.
echo. Create desktop shortcut...
echo [InternetShortcut] > "%LinkPath%"
echo URL=%URL_PATH% >> "%LinkPath%"
echo IDList= >> "%LinkPath%"
echo IconFile=%ICONDEST%\%IconName% >> "%LinkPath%"
echo IconIndex=0 >> "%LinkPath%"
echo HotKey=0 >> "%LinkPath%"
echo.
echo.
echo.
echo.
echo.You should now have a shortcut to %AppDescription% on your desktop...
echo.
echo.
pause
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With