Solved

create script to create a shortcut of exe file

Posted on 2013-11-28
6
538 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
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
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

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

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
The viewer will learn how to dynamically set the form action using jQuery.
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 …

710 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