Solved

create script to create a shortcut of exe file

Posted on 2013-11-28
6
541 Views
Last Modified: 2013-12-13
Hi Experts,

I need a batch script, which creates a shortcut from a exe file.
And this shortcut needs to be copied to the desktop of the users.
How can I solve this ?
0
Comment
Question by:Eprs_Admin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 9

Assisted Solution

by:Valliappan AN
Valliappan AN earned 250 total points
ID: 39683681
set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("AllUsersDesktop")
set oShellLink = WshShell.CreateShortcut(strDesktop & "\shortcut name.lnk")
oShellLink.TargetPath = "c:\application folder\application.exe"
oShellLink.WindowStyle = 1
oShellLink.IconLocation = "c:\application folder\application.ico"
oShellLink.Description = "Shortcut Script"
oShellLink.WorkingDirectory = "c:\application folder"
oShellLink.Save

Source: http://www.tomshardware.com/forum/52871-45-creating-desktop-shortcuts-command-line#.
Source2: http://stackoverflow.com/questions/346107/creating-a-shortcut-for-a-exe-from-a-batch-file

Thanks.
0
 

Author Comment

by:Eprs_Admin
ID: 39683739
Do you have it also for a batch file ?
0
 
LVL 9

Assisted Solution

by:Valliappan AN
Valliappan AN earned 250 total points
ID: 39683775
Save it as a createshortcutdesktop.vbs file.

Then create a batch file shortcut.bat file with contents like:

cscript createshortcutdesktop.vbs


 Does that help?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 43

Assisted Solution

by:Steve Knight
Steve Knight earned 250 total points
ID: 39684214
even easier, just create a shortcut how you want it with settings, icon etc. as you want then use copy or xcopy command to copy the. lnk file to their desktop, e.g.

xcopy /d \\server\share\shortcuts\*.lnk %userprofile%\desktop

will copy any shortcuts in the server directory to the users desktop in the default location.

Lots of other ways too but sometimes simple is adequate.

steve
0
 
LVL 43

Accepted Solution

by:
Steve Knight earned 250 total points
ID: 39686266
BTW I have an example script of mine here for how to make from batch file if you do want to make it on the fly rather than copy a pre-made one

http://scripts.dragon-it.co.uk/links/batch-make-shortcut
which I used in an EE question here:
http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Windows/Windows_7/Q_27423202.html

Effectively makes you a VBScript from the batch file.

Steve
0
 

Author Closing Comment

by:Eprs_Admin
ID: 39716033
thanks to all help
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Part One of the two-part Q&A series with MalwareTech.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question