bat結合vbs實現創(chuàng)建快捷方式@echo off ::設置程序或文件的路徑(必選) set Program=D:\Program Files\Microvirt\MEmu\MEmu.exe ::設置啟動參數(可選) set Arguments= ::設置快捷方式名稱(必選) set LnkName=test ::設置程序的工作路徑,一般為程序主目錄,此項若留空,腳本將自行分析路徑 set WorkDir= ::設置快捷方式顯示的說明(可選) set Desc= if not defined WorkDir call:GetWorkDir "%Program%" (echo Set WshShell=CreateObject("WScript.Shell"^) echo strDesKtop=WshShell.SpecialFolders("DesKtop"^) echo Set oShellLink=WshShell.CreateShortcut(strDesKtop^&"\%LnkName%.lnk"^) echo oShellLink.TargetPath="%Program%" echo oShellLink.Arguments="%Arguments%" echo oShellLink.WorkingDirectory="%WorkDir%" echo oShellLink.WindowStyle=1 echo oShellLink.Description="%Desc%" echo oShellLink.Save)>makelnk.vbs echo 桌面快捷方式創(chuàng)建成功! makelnk.vbs del /f /q makelnk.vbs exit goto :eof :GetWorkDir set WorkDir=%~dp1 set WorkDir=%WorkDir:~,-1% goto :eof vbs創(chuàng)建inkSet WshShell = WScript.CreateObject("WScript.Shell") strDesktop = WshShell.SpecialFolders("Desktop") :'特殊文件夾“桌面” set oShellLink = WshShell.CreateShortcut(strDesktop & "\計算器.lnk") oShellLink.TargetPath = "C:\Windows\System32\Calc.exe" : '目標 oShellLink.WindowStyle = 3 :'參數1默認窗口激活,參數3最大化激活,參數7最小化 oShellLink.Hotkey = "Ctrl+Alt+C" : '快捷鍵 oShellLink.IconLocation = "C:\Windows\System32\Calc.exe" : '圖標 oShellLink.Description = "系統(tǒng)默認計算器" : '備注 oShellLink.WorkingDirectory = strDesktop : '起始位置 oShellLink.Save : '創(chuàng)建保存快捷方式 |
|