"Back" | "Tab" | "Clear" | "Return" |
"Escape" | "Space" | "Prior" | ...
所有键的名称都可以在 WINUSER.H 中找到。热键不区分大小写。
热键只能激活位于 Windows 桌面或 Windows“开始”菜单的快捷方式。
Windows 资源管理器不接受 ESC、ENTER、TAB、SPACE、PRINT SCREEN 或 BACKSPACE,即使 WshShortcut.Hotkey 遵循 Win32 API 支持它们。因此,建议在快捷方式中不要用这些键。
示例
Set WshShell = Wscript.CreateObject("Wscript.WshShell")
strDesktop = WshShell.SpecialFolders("Desktop")
Set oMyShortcut = WshShell.CreateShortcut(strDesktop & "\a_key.lnk")
OMyShortcut.TargetPath = "%windir%\notepad.exe"
oMyShortCut.Hotkey = "ALT+CTRL+F"
oMyShortCut.Save
Wscript.Echo oMyShortCut.HotKey = "Alt+Ctrl+F"
请参阅
WshSpecialFolders 对象
WshShortcut.IconLocation
IconLocation 属性提供快捷方式对象的图标位置。图标位置的格式应为 "Path,index"。
语法
WshShortcut.IconLocation = strIconLocation
WshShortcut.TargetPath
TargetPath 属性提供快捷方式对象的目标路径。
语法
WshShortcut.TargetPath = strTargetPath
WshShortcut.WindowStyle
WindowStyle 属性提供快捷方式对象的窗口样式。
语法
WshShortcut.WindowStyle = natWindowStyle
WshShortcut.WorkingDirectory
WorkingDirectory 为一个快捷方式对象提供工作目录。
语法
WshShortcut.WorkingDirectory = strWorkingDirectory
WshShortcut.Save
Save 方法把快捷方式对象保存到由 FullName 属性指定的位置。
语法
WshShortcut.Save
WshUrlShortcut 对象
该对象未直接给出。要获取 WshUrlShortcut 对象,可使用 WshShell.CreateShortcut 方法。
ProgID N/A
文件名 WSHom.Ocx
CLSID
IID
下表说明了和 WshUrlShortcut 对象有关的属性。
属性 说明
FullName URL 快捷方式对象的完整路径。
TargetPath URL 快捷方式对象的目标路径。
&nbs
"Escape" | "Space" | "Prior" | ...
所有键的名称都可以在 WINUSER.H 中找到。热键不区分大小写。
热键只能激活位于 Windows 桌面或 Windows“开始”菜单的快捷方式。
Windows 资源管理器不接受 ESC、ENTER、TAB、SPACE、PRINT SCREEN 或 BACKSPACE,即使 WshShortcut.Hotkey 遵循 Win32 API 支持它们。因此,建议在快捷方式中不要用这些键。
示例
Set WshShell = Wscript.CreateObject("Wscript.WshShell")
strDesktop = WshShell.SpecialFolders("Desktop")
Set oMyShortcut = WshShell.CreateShortcut(strDesktop & "\a_key.lnk")
OMyShortcut.TargetPath = "%windir%\notepad.exe"
oMyShortCut.Hotkey = "ALT+CTRL+F"
oMyShortCut.Save
Wscript.Echo oMyShortCut.HotKey = "Alt+Ctrl+F"
请参阅
WshSpecialFolders 对象
WshShortcut.IconLocation
IconLocation 属性提供快捷方式对象的图标位置。图标位置的格式应为 "Path,index"。
语法
WshShortcut.IconLocation = strIconLocation
WshShortcut.TargetPath
TargetPath 属性提供快捷方式对象的目标路径。
语法
WshShortcut.TargetPath = strTargetPath
WshShortcut.WindowStyle
WindowStyle 属性提供快捷方式对象的窗口样式。
语法
WshShortcut.WindowStyle = natWindowStyle
WshShortcut.WorkingDirectory
WorkingDirectory 为一个快捷方式对象提供工作目录。
语法
WshShortcut.WorkingDirectory = strWorkingDirectory
WshShortcut.Save
Save 方法把快捷方式对象保存到由 FullName 属性指定的位置。
语法
WshShortcut.Save
WshUrlShortcut 对象
该对象未直接给出。要获取 WshUrlShortcut 对象,可使用 WshShell.CreateShortcut 方法。
ProgID N/A
文件名 WSHom.Ocx
CLSID
IID
下表说明了和 WshUrlShortcut 对象有关的属性。
属性 说明
FullName URL 快捷方式对象的完整路径。
TargetPath URL 快捷方式对象的目标路径。
&nbs