创建快捷方式并添加指定参数

发布于 2019-09-20  33 次阅读


单位的软件安装是一个小插件和简化版Chrome构成,安装的时候需要手动点添加到桌面很麻烦,所有就有了以下代码

echo "开始创建桌面快捷方式"
echo ThePath = "%cd%\Chromechangyouban\main\chrome.exe" >>Temp.vbs
echo lnkname = "%USERPROFILE%\desktop\杏林医院感染实时监控系统软件.lnk">>Temp.vbs
echo NewParameter = "--profile-directory=Default --app-id=dgjmpgjbkhfnlamgfddkhhehhofkljjc" >>Temp.vbs
echo WS = "Wscript.Shell">>Temp.vbs
echo Set Shell = CreateObject(WS)>>Temp.vbs
echo Set Link = Shell.CreateShortcut(lnkname)>>Temp.vbs
echo Link.Arguments = NewParameter>>Temp.vbs
echo Link.IconLocation = "%cd%\favicon.ico">>Temp.vbs
echo Link.TargetPath = ThePath>>Temp.vbs
echo Link.Save>>Temp.vbs
echo Set fso = CreateObject("Scripting.FileSystemObject")>>Temp.vbs
echo f = fso.DeleteFile(WScript.ScriptName)>>Temp.vbs
start Temp.vbs

春赏百花冬观雪,醒亦念卿,梦亦念卿。