bat创建桌面快捷方式,并用浏览器打开网页
前言
bat创建桌面快捷方式,并用浏览器打开网页,项目部署时使用
1.创建一个.bat文件
2.输入以下代码
@echo off
echo Set oWS = WScript.CreateObject("WScript.Shell") > CreateShortcut.vbs
echo sLinkFile = "%userprofile%\Desktop\lckj.lnk" >> CreateShortcut.vbs
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> CreateShortcut.vbs
echo oLink.TargetPath = "C:\Users\Administrator\appData\local\Google\chrome\application\chrome.exe" >> CreateShortcut.vbs
echo oLink.Arguments = "http://localhost:81" >> CreateShortcut.vbs
var pathe = "D:\pool\ChromeCore";
echo oLink.WorkingDirectory = pathe >> CreateShortcut.vbs
echo oLink.Description = "管理系统快捷方式" >> CreateShortcut.vbs
echo oLink.IconLocation = "D:\lckj\favicon.ico" >> CreateShortcut.vbs
echo oLink.Save >> CreateShortcut.vbs
cscript CreateShortcut.vbs
del CreateShortcut.vbs
3.双击执行就能在桌面找到快捷方式了,如果遇到中文乱码问题图标什么的没显示
win+R可以打开cmd,右键属性,查看cmd编码是否与bat文件相同
cmd编码为ANSI
将bat也另存为ANSI
至此大功告成