-
Say that you have a folder with 5 sub folders, which each have 5 files inside of them,
is there any way to create a program that creates short cuts for all of these files inside of the start menu folder. Where all u need to do is type in the location of the two folders.?? any help is great, thanks.
-
Solution
The following solution uses the FileSystemObject
Dim Folder As Object
Dim File As Object
Dim FileCollection As Object
Dim WSHShell As Object
Dim MyShortcut As Object
Dim RealFile As String
Set FileSysObject = CreateObject("Scripting.FileSystemObject")
Set WSHShell = CreateObject("WScript.Shell")
Set Folder = FileSysObject.GetFolder("F:\Files\")
Set FileCollection = Folder.Files
For Each File In FileCollection
RealFile = File.Name & ".lnk"
Set MyShortcut = WSHShell.CreateShortcut("C:\WINNT\Profiles\All Users\Start Menu\Programs\Startup\" & "\Shortcut to " & RealFile)
' Set shortcut object properties and save it
MyShortcut.TargetPath = File
MyShortcut.Save
Next
Hope this helps