为快捷方式指派窗口样式,或确定快捷方式使用的的窗口样式类型。
object.WindowStyle = intWindowStyle
WindowStyle 属性返回一个整数。
下表列出了 intWindowStyle 的可用设置。
| intWindowStyle | 说明 |
|---|---|
| 1 | 激活并显示窗口。如果该窗口被最小化或最大化,则系统将其还原到初始大小和位置。 |
| 3 | 激活窗口并将其显示为最大化窗口。 |
| 7 | 最小化窗口并激活下一个顶级窗口。 |
下面的示例演示 WindowStyle 属性的用法:
<package>
<job id="vbs">
<script language="VBScript">
set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
set oShellLink = WshShell.CreateShortcut(strDesktop & "\Shortcut Script.lnk")
oShellLink.TargetPath = WScript.ScriptFullName
oShellLink.WindowStyle = 1
oShellLink.Hotkey = "Ctrl+Alt+e"
oShellLink.IconLocation = "notepad.exe, 0"
oShellLink.Description = "Shortcut Script"
oShellLink.WorkingDirectory = strDesktop
oShellLink.Save
set oUrlLink = WshShell.CreateShortcut(strDesktop & "\Microsoft Web Site.url")
oUrlLink.TargetPath = "http://www.microsoft.com/china"
oUrlLink.Save
</script>
</job>
<job id="js">
<script language="JScript">
var WshShell = WScript.CreateObject("WScript.Shell");
strDesktop = WshShell.SpecialFolders("Desktop");
var oShellLink = WshShell.CreateShortcut(strDesktop + "\\Shortcut Script.lnk");
oShellLink.TargetPath = WScript.ScriptFullName;
oShellLink.WindowStyle = 1;
oShellLink.Hotkey = "Ctrl+Alt+e";
oShellLink.IconLocation = "notepad.exe, 0";
oShellLink.Description = "Shortcut Script";
oShellLink.WorkingDirectory = strDesktop;
oShellLink.Save();
var oUrlLink = WshShell.CreateShortcut(strDesktop + "\\Microsoft Web Site.url");
oUrlLink.TargetPath = "http://www.microsoft.com/china";
oUrlLink.Save();
</script>
</job>
</package>