![]() I present a small hybrid script to create a desktop shortcut.Īnd you can of course modifie it to your purpose. Note that MyApp48.bmp is a 48x48 pixel image.Įcho Set oWS = WScript.CreateObject("WScript.Shell") > CreateShortcut.vbsĮcho sLinkFile = "%userprofile%\Desktop\MyApp.lnk" > CreateShortcut.vbsĮcho Set oLink = oWS.CreateShortcut(sLinkFile) > CreateShortcut.vbsĮcho oLink.TargetPath = "C:\MyApp\MyApp.bat" > CreateShortcut.vbsĮcho oLink.WorkingDirectory = "C:\MyApp" > CreateShortcut.vbsĮcho oLink.Description = "My Application" > CreateShortcut.vbsĮcho oLink.IconLocation = "C:\MyApp\MyApp48.bmp" > CreateShortcut.vbs I wanted the shortcut to appear on the desktop.īut I also needed to set the icon, the description, and the working directory. ![]() I didn't try mklink, since I didn't want to mess with permissions. ![]() The JScript solution gave me syntax errors. The PowerShell solution ran, but no shortcut appeared. Rohit Sahu's answer worked best for me in Windows 10.
0 Comments
Leave a Reply. |