范本
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
Option Explicit Dim wshShell, Shortcut Dim strDir, strName strName = "命令提示符" Set wshShell = WSH.CreateObject("WScript.Shell") strDir = wshShell.SpecialFolders("Desktop") Set Shortcut = wshShell.CreateShortcut(strDir &_ "\" & strName & ".lnk") Shortcut.TargetPath = "C:\Windows\System32\cmd.exe" Shortcut.WindowStyle = 1 Shortcut.Hotkey = "CTRL+ALT+U" Shortcut.Description = "这是命令提示符程序描述" Shortcut.WorkingDirectory = strDir Shortcut.Save Set Shortcut = Nothing Set wshShell = Nothing |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
Option Explicit Dim wshShell, Shortcut Dim strDir, strName strDir = "D:\" strName = "命令提示符" Set wshShell = WSH.CreateObject("WScript.Shell") Set Shortcut = wshShell.CreateShortcut(strDir &_ "\" & strName & ".lnk") Shortcut.TargetPath = "C:\Windows\System32\cmd.exe" Shortcut.WindowStyle = 1 Shortcut.Hotkey = "CTRL+ALT+U" Shortcut.Description = "这是命令提示符程序描述" Shortcut.WorkingDirectory = strDir Shortcut.Save Set Shortcut = Nothing Set wshShell = Nothing |
以上转自https://wangye.org/blog/archives/110/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
@echo off for /f "tokens=2,*" %%i in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Desktop"') do (set Desktop=%%j) set 快捷方式名称=SanGod set ShortCutPath=%Desktop%\%快捷方式名称%.lnk set 快捷方式图标=desktop.ico set IconLocation=%~dp0%快捷方式图标% set 源程序路径=SanGod.bat set SoftPath=%~dp0%源程序路径% echo Dim WshShell,Shortcut>tmp.vbs echo Dim path,fso>>tmp.vbs echo path="%SoftPath%">>tmp.vbs echo Set fso=CreateObject("Scripting.FileSystemObject")>>tmp.vbs echo Set WshShell=WScript.CreateObject("WScript.Shell")>>tmp.vbs echo Set Shortcut=WshShell.CreateShortCut("%ShortCutPath%")>>tmp.vbs echo Shortcut.WorkingDirectory="%~dp0">>tmp.vbs echo Shortcut.IconLocation="%IconLocation%">>tmp.vbs echo Shortcut.TargetPath=path>>tmp.vbs echo Shortcut.Save>>tmp.vbs "%SystemRoot%\System32\WScript.exe" tmp.vbs del /s /q tmp.vbs >nul 2>nul start /min "" "%~dp0" start /realtime %ShortCutPath% |
发表回复