如何创建一个批处理文件创建一个快捷方式到网页 [英] How to create a batch file to create a shortcut to a webpage
问题描述
我要创建一个在桌面上创建或者在开始菜单的快捷方式的批处理文件。
I want to create a batch file which creates a shortcut on the desktop or in the start menu.
快捷方式需要打开一个网页这是一个本地的Windows服务器的IP地址(如http:\\ 192.168的 * :81 \\')
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.
下面是我用它来管理URL快捷方式批处理脚本:
(请注意,此脚本假定一个图标也存在 - MyIconName.ico - 在同一目录作为这个脚本如果图标不可用或者不需要,只需省略了相关行)
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
这篇关于如何创建一个批处理文件创建一个快捷方式到网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!