Solved

create script to create a shortcut of exe file

Posted on 2013-11-28
6
515 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
Comment Utility
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
Comment Utility
Do you have it also for a batch file ?
0
 
LVL 9

Assisted Solution

by:Valliappan AN
Valliappan AN earned 250 total points
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 43

Assisted Solution

by:Steve Knight
Steve Knight earned 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
thanks to all help
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

763 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

10 Experts available now in Live!

Get 1:1 Help Now