/build/static/layout/Breadcrumb_cap_w.png

Creating a shortcut after copy a program with a batch file.

One of my users is wanting to have a program called Assembly Planner added to the App Store.  This particular program does not have an installer.  Instead, you copy the folder in it's entirety to the c drive of the computer.  You then create a shortcut to the executable and place it on the desktop.  I can successfully copy the folder to the C drive by using the batch file below.  However, I haven't quite figured out how to create the shortcut once it's been copied.  I've tried creating the shortcut and placing it in the source folder for the copy and using a second batch file to copy it to the desktop, but the second batch job never seems to kick off.  I've checked out the shortcut wizard, but I don't want the users to have to click on two different installs.  Here is what my setup looks like.  Any help is appreciated.

 


0 Comments   [ + ] Show comments

Answers (4)

Answer Summary:
Posted by: titusr 9 years ago
Senior White Belt
0

I'm not familiar with using KACE but I see no need to create a second batch file to copy the shortcut, just add a second line to copy the shortcut to the first batch file. Are you sure the second batch file isn't running? I can't see the full text of it but if you're trying to copy something you should start the batch with the command copy not just the file paths.

If that option doesn't work I've always used vbscript to create shortcuts, Example:

set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("AllUsersDesktop")
set oShellLink = WshShell.CreateShortcut(strDesktop & "\programName.lnk")
oShellLink.TargetPath = "path to executable"
oShellLink.WindowStyle = 1
oShellLink.IconLocation = "path to executable,0"
oShellLink.Description = "program name"
oShellLink.WorkingDirectory = "folder executable is in"
oShellLink.Save
 
You could create this vbs (replaceing the text in italic to the proper values), save it to a network drive then call it from your batch. This method has always worked for me. Unfortunately the batch language isn't sophisticated enough to create a shortcut (at least I've never been able to get it to work)
 
Hope this is helpful
Posted by: SMal.tmcc 9 years ago
Red Belt
0

put the link the the source folder and add xcopy \\source\*.LNK C:\Users\Public\Desktop as a scond line of the first batch file

Posted by: roal 9 years ago
White Belt
0

You can create a shortcut by using mklink like this:   mklink "Path to shortcut" "Path to exe file"

This can be useful in cases where you can't use SMal.tmcc's solution.. (when deploying to several users and the target path is located somewhere in the %userprofile% structure)


example:

mklink "%userprofile%\desktop\NewLinkName" "c:\%userprofile%\Appdata\Roaming\Program\Executable.exe"

Posted by: nick.hobbs 9 years ago
Senior White Belt
0
Thanks guys.  I was finally able to get it up and running.  I created one batch file that did both jobs and that seems to have corrected my problem.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ