您的位置:首页 > 运维架构 > Shell

Wscript.Shell对象详细介绍!!(3)

2005-11-25 20:06 495 查看
; StrMyDesktop = WshShell.SpecialFolders("Desktop")

' List all special folders
For Each strFolder In WshShell.SpecialFolders
MsgBox strFolder
Next

请参阅
WshShell.SpecialFolders 属性

WshShell.CreateShortcut
CreateShortcut 方法创建 WshShortcut 对象并将其返回。如果快捷方式标题以 .url 结尾,就会创建 WshURLShortcut 对象。

语法
WshShell.CreateShortcut(strPathname) = objShortcut

示例
' This code fragment creates a shortcut
' to the currently executing script
Set WshShell = Wscript.CreateObject("Wscript.Shell")
Set oShellLink = WshShell.CreateShortcut("Current Script.lnk")
oShellLink.TargetPath = Wscript.ScriptFullName
oShellLink.Save
Set oUrlLink = WshShell.CreateShortcut("Microsoft Web Site.URL")
oUrlLink.TargetPath = "http://www.microsoft.com"
oUrlLink.Save

请参阅
WshShortcut 对象、WshUrlShortcut 对象

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" |
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: