To get an access to all these special folders we can either use method GetFolder() of the FileSystemObject as discussed before or use special property SpecialFolders of the WshShell object. This property is a collection of all special folders. To access a particular folder inside the collection we need to provide the name of the folder. The list of all available names with short description is given in the table.
| Folder | Description |
|---|---|
| AllUsersDesktop | Desktop shortcuts for all users |
| AllUsersStartMenu | Start menu options for all users |
| AllUsersPrograms | Programs menu for all users |
| AllUsersStartup | Startup applications for all users |
| Desktop | Desktop shortcuts for the current user |
| Favorites | Favorites menu shortcuts for the current user |
| Fonts | Fonts folder shortcuts for the current user |
| MyDocuments | My Documents menu for the current user |
| NetHood | Network neighborhood shortcuts for the current user |
| PrintHood | Printers folder shortcuts for the current user |
| Programs | Programs menu options for the current user |
| Recent | Recently used documents for the current user |
| SendTo | SentTo menu shortcuts for the current user |
| StartMenu | Start menu shortcuts for the current user |
| Startup | Startup applications for the current user |
| Templates | Templates folder shortcuts for the current user |
var shell = WScript.CreateObject("WScript.Shell");
var desktop = shell.SpecialFolders("Desktop");
The WshShortcut object has a set of properties and only one method Save(). We need to use this method when all modifications to an open shortcut are performed.
| Property | Description |
|---|---|
| Arguments | Arguments to pass to an application started through the shortcut |
| Description | Sets a description for the shortcut |
| FullName | Returns the fully qualified path of the shortcut object's target. |
| Hotkey | Sets a hot key sequence that activates the shortcut. Can only be used with desktop shortcuts and Start menu options. |
| IconLocation | Sets the location of an icon for the shortcut. If not set, a default icon is used. The number after the file name indicates the position of the icon. |
| TargetPath | Sets the path of the file to execute. |
| WindowStyle | Sets the window style of the application started by the shortcut. The default value is 1. The available styles are the same as options 0-6 discussed before. |
| WorkingDirectory | Sets the working directory of the application started by the shortcut |
var shell = WScript.CreateObject("WScript.Shell");
var desktop = shell.SpecialFolders("Desktop");
var scut = shell.CreateShortcut(desktop+"\\notes.lnk");
scut.TargetPath = "%windir%\\notepad.exe";
scut.Description = "Things to do today";
scut.Arguments = "c:\\temp\\mynotes.txt";
scut.Hotkey = "CTRL+ALT+N";
scut.IconLocation = "C:\\WINDOWS\\explorer.exe,5";
scut.Save();
In the next example we will create a URL shortcut.
var shell = WScript.CreateObject("WScript.Shell");
var desktop = shell.SpecialFolders("Desktop");
var scut = shell.CreateShortcut(desktop+"\\IST.url");
scut.TargetPath = "http://ist.marshall.edu";
scut.Save();
The same properties can be used to obtain information about a particular shortcut. To retrieve all information about a
shortcut, we need to use the same method CreateShortcut() to open it and then the same properties to
read all information.
![]() |
Please write a script that takes a shortcut name as an argument and prints all information about this shortcut. |