R
R
RoboCat2016-08-09 18:57:37
VBScript
RoboCat, 2016-08-09 18:57:37

How to create a shortcut to a folder?

You need to create a shortcut to the folder.
There is an error in the line in which I set the target argument.. it says - the argument must end with lnk.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lvv85, 2016-08-10
@lvv85

Set WSHShell = WScript.CreateObject("WScript.Shell")

'folderPath - папка в которой будет создан ярлык target.lnk
folderPath = "C:\Users\user\Desktop"

Set link = WSHShell.CreateShortcut(folderPath + "\target.lnk")

'targetPath - папка для которой необходимо создать ярлык
targetPath = "C:\Users\user\Desktop\target_folder"

link.TargetPath = targetPath

link.Save

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question