I create a shortcut with a script, but why? Some applications do not know the cause, do not create a shortcut during installation or after installation. The following Script allows you to create shortcuts with the variables entered.
The shortcut name, shortcut path, file name of the target application, shortcut icon, and system architecture are automatically selected.
‘Script Started
‘Option Explicit
‘Create Shortcut
strComputer = “.”
On Error Resume Next
Dim objShell, objDesktop, objLink, strDesc,objItem ,colItems
Dim strAppPath, strWorkDir , WshShell
Set WshShell = Wscript.CreateObject(“Wscript.Shell”)
Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”)
Set colItems = objWMIService.ExecQuery(“Select * from Win32_ComputerSystem”,,48)
For Each objItem in colItems
If objItem.SystemType = “x64-based PC” Then
‘Variables
strWorkDir =”C:\”
strAppPath = “C:\Program Files (x86)\Google\Chrome\Application\chrome.exe”
strDesc=”Google Chrome”
‘——
Set objShell = CreateObject(“WScript.Shell”)
objDesktop=objShell.SpecialFolders(“Desktop”)
Set objLink = objShell.CreateShortcut(objDesktop & “\Google Chrome.lnk”)
objLink.Description = strDesc
objLink.TargetPath = strAppPath
objLink.WindowStyle = 3
objLink.WorkingDirectory = strWorkDir
objLink.IconLocation = “C:\Program Files (x86)\Google\Chrome\Application\chrome.exe”
objLink.Save
‘————————————-‘
‘ Add Registry key
else
‘Variables
strWorkDir =”C:\”
strAppPath = “C:\Program Files (x86)\Google\Chrome\Application\chrome.exe”
strDesc=”Google Chrome”
‘——
Set objShell = CreateObject(“WScript.Shell”)
objDesktop=objShell.SpecialFolders(“Desktop”)
Set objLink = objShell.CreateShortcut(objDesktop & “\Google Chrome.lnk”)
objLink.Description = strDesc
objLink.TargetPath = strAppPath
objLink.WindowStyle = 3
objLink.WorkingDirectory = strWorkDir
objLink.IconLocation = “C:\Program Files (x86)\Google\Chrome\Application\chrome.exe”
objLink.Save
end if
next
wscript.quit
‘Script Finished
Enjoy!