CreateShortcut

CreateShortcut Method


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();
复制代码

 

posted @   小风风的博客  阅读(63)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· AI 智能体引爆开源社区「GitHub 热点速览」
· 写一个简单的SQL生成工具
点击右上角即可分享
微信分享提示