Windows 脚本宿主  

复制快捷方式

复制快捷方式需要用到文件系统对象 (FSO)。下面的脚本将演示如何使用文件系统对象来复制快捷方式。

// JScript。
Shell = new ActiveXObject("WScript.Shell");
FSO = new ActiveXObject("Scripting.FileSystemObject");
DesktopPath = Shell.SpecialFolders("Desktop") + "\\MSDN Scripting url";
MyDocumentsPath = Shell.SpecialFolders("MyDocuments") + "\\"
FSO.CopyFile(DesktopPath,MyDocumentsPath);

' VBScript。
Set Shell = CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
DesktopPath = Shell.SpecialFolders("Desktop") + "\MSDN Scripting.url"
MyDocumentsPath = Shell.SpecialFolders("MyDocuments") + "\\"
FSO.CopyFile DesktopPath,MyDocumentsPath

请参阅

管理快捷方式