zoukankan      html  css  js  c++  java
  • WshShortcut 对象说明

    WshShortcut 对象
    该对象未直接给出。要获得 WshShortcut 对象,请使用 WshShell.CreateShortcut 方法。

    ProgID N/A
    文件名 WSHom.Ocx
    CLSID F935DC28-1CF0-11d0-ADB9-00C04FD58A0B
    IID F935DC27-1CF0-11d0-ADB9-00C04FD58A0B

    下表说明和 WshShortcut 对象有关的属性。

    属性 说明
    Arguments 快捷方式对象的参数。
    Description 快捷方式对象的说明。
    Hotkey 快捷方式对象的热键。
    IconLocation 快捷方式对象的图标位置。
    TargetPath 快捷方式对象的目标路径。
    WindowStyle 快捷方式对象的窗口样式。
    WorkingDirectory 快捷方式对象的工作目录。

    下表说明与 WshShortcut 对象有关的方法。

    方法 说明
    Save 将快捷方式存储到指定的文件系统中。

    WshShortcut.Arguments
    Arguments 属性提供快捷方式对象的参数。

    语法
    WshShortcut.Arguments = strArguments

    WshShortcut.Description
    Description 属性提供快捷方式对象的说明。

    语法
    WshShortcut.Description = strDescription

    WshShortcut.Hotkey
    HotKey 属性提供快捷方式对象的热键。热键是启动或切换程序的键盘快捷方式。

    语法
    WshShortcut.HotKey = strHotKey

    注释
    strHotKey 的BNF语法如下:

    Hotkey ::= modifier* keyname
    modifier ::= "ALT+" | "CTRL+" | "SHIFT+" | "EXT+"
    keyname ::= "A" .. "Z" |
    "0".. "9" |
    "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 属性提供快捷方式对象的目标路径。

    语法
    WshShort

    WshUrlShortcut 对象
    该对象未直接给出。要获取 WshUrlShortcut 对象,可使用 WshShell.CreateShortcut 方法。

    ProgID N/A
    文件名 WSHom.Ocx
    CLSID
    IID

    下表说明了和 WshUrlShortcut 对象有关的属性。

    属性 说明
    FullName URL 快捷方式对象的完整路径。
    TargetPath URL 快捷方式对象的目标路径。

    下表说明了和 WshUrlShortcut 对象有关的方法。

    方法 说明
    Save 将快捷方式保存到指定的文件系统中。

    WshUrlShortcut.FullName
    FullName 属性提供快捷方式对象的完整路径。

    语法
    WshUrlShortcut.FullName = strFullName

    WshUrlShortcut.TargetPath
    TargetPath 属性提供快捷方式对象的目标路径。

    语法
    WshUrlShortcut.TargetPath = strTargetPath

    WshUrlShortcut.Save
    Save 方法保存一个快捷方式,该快捷方式指向 FullName 属性指定的位置。

    语法
    WshUrlShortcut.Save

  • 相关阅读:
    如何写一个简单的HTTP服务器(重做版)
    如何写一个简单的shell
    Linux守护进程
    字节序:大端法和小端法
    学习计算机需要看哪些经典书?
    IA32寄存器与x86-64寄存器的区别
    C++中extern关键字用法小结
    操作系统中陷阱,中断和异常的区别
    排查CPU占用过高的问题
    git初始化、获取git仓库
  • 原文地址:https://www.cnblogs.com/hetonghai/p/1208008.html
Copyright © 2011-2022 走看看