Solved

create script to create a shortcut of exe file

Posted on 2013-11-28
6
518 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 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

This is an explanation of a simple data model to help parse a JSON feed
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

920 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now