ZSet WSHShell=$ZCreateObject("WScript.Shell")
S DesktopPath=WSHShell.SpecialFolders("Desktop")
S MyShortcut=WSHShell.CreateShortcut(DesktopPath_"\Notepad Shortcut.lnk")
S Windir=WSHShell.ExpandEnvironmentStrings("%windir%")
S MyShortcut.TargetPath=WinDir_"\notepad.exe"
S MyShortcut.WorkingDirectory=WinDir
S MyShortcut.WindowStyle=4
S MyShortcut.IconLocation=WinDir_"\notepad.exe, 0"
D MyShortcut.Save
K WSHShell
Thansk
Did you check that everything works as expected?
> ZSet WSHShell=$ZCreateObject("WScript.Shell")
> S DesktopPath=WSHShell.SpecialFolders("Desktop")
W DesktopPath,!
> S MyShortcut=WSHShell.CreateShortcut(DesktopPath_"\Notepad Shortcut.lnk")
> S Windir=WSHShell.ExpandEnvironmentStrings("%windir%")
W Windir,!
For the benefit of other readers, this os MSM-Workstation stuff.
>
> ZSet WSHShell=$ZCreateObject("WScript.Shell")
> S DesktopPath=WSHShell.SpecialFolders("Desktop")
> S MyShortcut=WSHShell.CreateShortcut(DesktopPath_"\Notepad Shortcut.lnk")
Make that a ZSET rather than a SET, because you want to store the object
that CreatShortcut() returns. A simple SET lets you store the default
property of that object, so MyShortcut holds a string rather than an object.
> S Windir=WSHShell.ExpandEnvironmentStrings("%windir%")
That should be WinDir, not Windir.
> S MyShortcut.TargetPath=WinDir_"\notepad.exe"
> S MyShortcut.WorkingDirectory=WinDir
> S MyShortcut.WindowStyle=4
> S MyShortcut.IconLocation=WinDir_"\notepad.exe, 0"
> D MyShortcut.Save
> K WSHShell
Now it works (for me), creating a desktop shortcut called "Notepad
Shortcut".
HTH
John
Carlos Alberto