Create a desktop shortcut with the FSO

Source: Internet
Author: User
Tags object model

Brief introduction
File system Object The FSO's English full name is the filename, object model, which presents a method for handling files and folders differently from traditional file manipulation statements. By using Object.Method, a widely used syntax in object-oriented programming, the actions of a series of operations files and folders are implemented directly by invoking the properties of the object itself

<script type= "text/web Effects" language= "JavaScript" >
Create shortcut [browser settings are low, FF does not support]
function CreateShortcut () {
var fso = new ActiveXObject ("Scripting.FileSystemObject");
var shell = new ActiveXObject ("Wscript.Shell");
Get desktop Local Desktop address
var tagfolder = shell.specialfolders ("desktop");
if (!fso.folderexists (Tagfolder)) {
Fso.createfolder (Tagfolder);
}
if (!fso.fileexists (Tagfolder +//script House. lnk)) {
Create a shortcut named Baidu.lnk under the specified folder
var link = shell.createshortcut (tagfolder + "//111cn.net.lnk");
corresponding descriptive information
link.description = "Script House";
The link to which the shortcut points
Link.targetpath = "Http://www.111cn.net";
Activate the link and maximize the window
Link.windowstyle = 3;
Link.save ();
}
}
CreateShortcut ();
</script>

Wscript.Shell is an important part of the VBS scripting language, and VBScript is the abbreviation for Visual Basic Script, the Visual Basic scripting language, sometimes abbreviated as VBS.   is the ASP Tutorial Dynamic Web page Default programming language, with ASP built-in objects and ADO objects, users will soon be able to access the Database tutorial ASP Dynamic Web page development technology. WshShell object ProgID wscript.shell filename wshom.ocx clsid f935dc22-1cf0-11d0-adb9-00c04fd58a0b IID F935dc21-1cf0-11d0-a   DB9-00C04FD58A0B describes the properties associated with the WshShell object below.   Property Description Environment Returns the Wshenvironment collection object.   Specialfolders uses the Wshspecialfolders object to provide access to Windows shell folders, such as Desktop folders, Start menu folders, and personal documents folders. The following describes the methods associated with the WshShell object

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.