Tech Support > Microsoft Windows > Copy shortcut to desktop
Copy shortcut to desktop
Posted by Shallnot on October 17th, 2005


i am trying to find a script that will copy a shortcut from my program folder
to the user desktop. This seems it should be easy however I am not a
programmer and would appretiate any help that you could provide.
--
Information Services Manager

Posted by Dave Patrick on October 17th, 2005


This VBScript would create a shortcut to a mapped drive 'S:\'

--------------------------
set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
set oShellLink = WshShell.CreateShortcut(strDesktop & "\S Drive.lnk")
oShellLink.TargetPath = "S:\"
oShellLink.WindowStyle = 1
oShellLink.IconLocation = "explorer.exe, 1"
oShellLink.Description = "Network S Drive"
oShellLink.WorkingDirectory = "S:\"
oShellLink.Save
Set WshShell = Nothing
Set oShellLink = Nothing
--------------------------
Depending on what you're wanting, use either;

WshShell.SpecialFolders("Desktop")
WshShell.SpecialFolders("AllUsersDesktop")

Also WSH 5.6 documentation download at
http://www.microsoft.com/downloads/d...displaylang=en



--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"Shallnot" wrote:
|i am trying to find a script that will copy a shortcut from my program
folder
| to the user desktop. This seems it should be easy however I am not a
| programmer and would appretiate any help that you could provide.
| --
| Information Services Manager


Posted by Ramesh, MS-MVP on October 17th, 2005


Adding to Dave:

How to create a desktop shortcut with the Windows Script Host:
http://support.microsoft.com/kb/q244677/

How To Use Windows Script Host to Create Shortcut with Parameters:
http://support.microsoft.com/?kbid=242297

If you prefer a third-party tool to automate this, see:

Optimum X Download Page:
http://www.optimumx.com/download/#Shortcut

Shortcut [Version 1.11]

Creates, modifies or queries Windows shell links (shortcuts)


The syntax of this command is:

Shortcut.exe /F:filename /A:C|E|Q [/T:target] [/Parameters]
[/W:workingdir]
[/R:runstyle] [/I:icon,index] [/H:hotkey] [/D:description]

/F:filename : Specifies the .LNK shortcut file.
/A:action : Defines the action to take (C=Create, E=Edit or Q=Query).
/T:target : Defines the target path and file name the shortcut points
to.
/Parameters : Defines the command-line parameters to pass to the target.
/W:working dir : Defines the working directory the target starts with.
/R:run style : Defines the window state (1=Normal, 3=Max, 7=Min).
/I:icon,index : Defines the icon and optional index (file.exe or
file.exe,0).
/H:hotkey : Defines the hotkey, a numeric value of the keyboard
shortcut.
/D:description : Defines the description (or comment) for the shortcut.

Notes:
- Any argument that contains spaces must be enclosed in "double quotes".
- If Query is specified (/A:Q), all arguments except /F: are ignored.
- To find the numeric hotkey value, use Explorer to set a hotkey and then
/A:Q
- To prevent an environment variable from being expanded until the shortcut
is launched, use the ^ carat escape character like this: ^%WINDIR^%

Examples:
/f:"%ALLUSERSPROFILE%\Start Menu\Programs\My App.lnk" /a:q
/f:"%USERPROFILE%\Desktop\Notepad.lnk" /a:c /t:^%WINDIR^%\Notepad.exe
/h:846
/f:"%USERPROFILE%\Desktop\Notepad.lnk" /a:e /p:C:\Setup.log /r:3

An argument of /? or -? displays this syntax and returns 1.
A successful completion will return 0.

Copyright 2000-2005 Marty List, www.OptimumX.com

--
Ramesh, Microsoft MVP
Windows XP Shell/User

Windows XP Troubleshooting
http://www.winhelponline.com


"Shallnot" <Shallnot@discussions.microsoft.com> wrote in message
news:CD8AB9AF-DCB5-4588-9914-7777C5E213E7@microsoft.com...
>i am trying to find a script that will copy a shortcut from my program
>folder
> to the user desktop. This seems it should be easy however I am not a
> programmer and would appretiate any help that you could provide.
> --
> Information Services Manager



Similar Posts