Automatically creating shortcut

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello everybody

I need some help on this: I need to automatically create a desktop shortcut
when a user first logs into her (his) Terminal server session, the problem is
that the shortcut must point to a location under her(his) documents path, so
I need to be able to introduce a variable %USERNAME% into the desktop shorcut
creation in order to be created pointing to the right place.

Any ideas?

Thanks
 
Hi Alfredo

You can use this to create the shortcut

Dim WSHShell
Set WSHShell = WScript.CreateObject("WScript.Shell")
Dim MyShortcut, MyDesktop ', DesktopPath
' Create a shortcut object on the desktop
strUserProfile = WSHShell.ExpandEnvironmentStrings("%userprofile%")
Set MyShortcut = WSHShell.CreateShortcut(strUserProfile & "\Desktop\Link
Name.lnk")

' Set shortcut object properties and save it
MyShortcut.TargetPath = WSHShell.ExpandEnvironmentStrings("c:\program
files\program folder\program.exe")
MyShortcut.WorkingDirectory = WSHShell.ExpandEnvironmentStrings("c:\program
files\program folder")
MyShortcut.WindowStyle = 4
MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings("c:\program
files\program folder\program.exe, 0")
MyShortcut.Save

I think that should work

Nathan
 
Back
Top