16. VbScript | Shortcuts

Try the Code – Ask Questions – Ask me what you need.

Today we are going to talk about making shortcuts to any file or folder. The code is as follows:

Shortcuts have the extension .lnk, which stands for links. It does not matter whether the shortcut is for a folder or file.

So far, we have 1. the place where the shortcut is created, 2. the name of the shortcut which is newshortcut.lnk. Now we need to specify the file or folder we are going to make a shortcut for. So we are going to store/set the CreateObject (“wscript.shell”) as a variable. Like so:

Continuing, to change our shortcut to anything we want:

TargetPath will choose what VbScript makes a shortcut for. ie. if I have a MP3 file in the downloads folder that I want to make a shortcut for:

1 2



What's Your Opinion?