提供對(duì)本地 Windows 外殼程序的訪問(wèn)。
如果需要在本地運(yùn)行程序、操縱注冊(cè)表內(nèi)容、創(chuàng)建快捷方式或訪問(wèn)系統(tǒng)文件夾,請(qǐng)創(chuàng)建 WshShell 對(duì)象。WshShell 對(duì)象提供 Environment 集。Environment 集可用來(lái)處理環(huán)境變量(如 WINDIR、PATH 或 PROMPT)。
下面的示例演示創(chuàng)建正在運(yùn)行腳本的快捷方式和 www.microsoft.com 的 URL快捷方式:
<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+SHIFT+F"
oShellLink.IconLocation = "notepad.exe, 0"
oShellLink.Description = "Shortcut Script"
oShellLink.WorkingDirectory = strDesktop
oShellLink.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+SHIFT+F";
oShellLink.IconLocation = "notepad.exe, 0";
oShellLink.Description = "Shortcut Script";
oShellLink.WorkingDirectory = strDesktop;
oShellLink.Save();
</script>
</job>
</package>
CurrentDirectory 屬性 | Environment 屬性 | SpecialFolders 屬性
AppActivate 方法 | CreateShortcut 方法 | ExpandEnvironmentStrings 方法 | LogEvent 方法 | Popup 方法 | RegDelete 方法 | RegRead 方法 | RegWrite 方法 | Run 方法 | SendKeys 方法 | Exec 方法