Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

create script to create a shortcut of exe file

Posted on 2013-11-28
6
Medium Priority
?
583 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
  • 2
  • 2
  • 2
6 Comments
 
LVL 9

Assisted Solution

by:Valliappan AN
Valliappan AN earned 1000 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 1000 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 43

Assisted Solution

by:Steve Knight
Steve Knight earned 1000 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 1000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to count occurrences of each item in an array.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

963 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