The below will show you how to use a VBS Script to Create a Shortcut and also a URL shortcut to a webpage.

In the below example script I am simply creating a shortcut to Notepad using the properties .TargetPath and . Description however there are a few other properties you can make use of.

 

Property Description
Arguments Additional command-line arguments that can be used when starting the application.
Description Description given to the shortcut.
FullName Read-only property that returns the complete path to the target application.
HotKey Keyboard shortcut: a combination of keys that, when held down together, will start the application. Keyboard shortcuts typically consist of one of the following keys plus a letter (az), number (09), or function key (F1F12):

  • ALT
  • CTRL
  • SHIFT

For example, to set the keyboard shortcut to the CTRL key and the 9 key, use this value:

CTRL + 9

If the key combination you select is already in use, it will be overwritten and will be applied to the new shortcut created by your script.

IconLocation Allows you to specify an icon and an icon index for the shortcut. If no location is specified, the default icon for the application is used.
TargetPath Complete path to the target application. You must specify the full path, including the drive letter or UNC path.

When setting a TargetPath, WSH will accept the value entered. It will not check to ensure that the path is correct.

WindowStyle Specifies the initial window type for the application. Valid styles are the same as those shown for the Run method and are listed in Table 3.9.
WorkingDirectory Specifies the working directory for the application.

 

 Example 1:

 

Creating a URL Shortcut

URL shortcuts are created in the same way however they do not support all of the properties or a Standard shortcut, the file name must also be a .url not a .lnk

Example 2: