首页 > 其他分享 >CreateShortcut

CreateShortcut

时间:2023-08-23 14:48:10浏览次数:28  
标签:oUrlLink oShellLink WScript strDesktop WshShell CreateShortcut

CreateShortcut Method

See Also

Running Your Scripts | WshShortcut Object | WshUrlShortcut Object | WshShell Object



Creates a new shortcut, or opens an existing shortcut.

object.CreateShortcut(strPathname) 

Arguments

object
WshShell object.
strPathname
String value indicating the pathname of the shortcut to create. 


 1       var WshShell = WScript.CreateObject("WScript.Shell");
 2          strDesktop = WshShell.SpecialFolders("Desktop");
 3          var oShellLink = WshShell.CreateShortcut(strDesktop + "\\Shortcut Script.lnk");
 4          oShellLink.TargetPath = WScript.ScriptFullName;
 5          oShellLink.WindowStyle = 1;
 6          oShellLink.Hotkey = "CTRL+SHIFT+F";
 7          oShellLink.IconLocation = "notepad.exe, 0";
 8          oShellLink.Description = "Shortcut Script";
 9          oShellLink.WorkingDirectory = strDesktop;
10          oShellLink.Save();
11          var oUrlLink = WshShell.CreateShortcut(strDesktop + "\\Microsoft Web Site.url");
12          oUrlLink.TargetPath = "http://www.microsoft.com";
13          oUrlLink.Save();

 

标签:oUrlLink,oShellLink,WScript,strDesktop,WshShell,CreateShortcut
From: https://www.cnblogs.com/qzxff/p/17651556.html

相关文章