How can I copy a shortcut to my application on to the users Desktop?
AutoRun Wizard has no built-in option to create a desktop shortcut, but a small script does it. The usual place for this is your program's installer: most installer tools have a "create desktop shortcut" option, which is the cleanest solution. If you are not using an installer, autorun this batch file.
Create the batch file
Open Notepad and paste the following, then change the four values marked in the first lines:
@echo off
set "NAME=My Application"
set "TARGET=C:\Program Files\My Application\MyApp.exe"
set "ICON=C:\Program Files\My Application\MyApp.exe"
set "WORKDIR=C:\Program Files\My Application"
powershell -NoProfile -Command "$d=[Environment]::GetFolderPath('Desktop'); $s=(New-Object -ComObject WScript.Shell).CreateShortcut((Join-Path $d ($env:NAME + '.lnk'))); $s.TargetPath=$env:TARGET; $s.IconLocation=$env:ICON; $s.WorkingDirectory=$env:WORKDIR; $s.Save()"- Choose File > Save as, set "Save as type" to All files, and name it
addshortcut.bat. - Copy it into your Base Folder and add it as one of your autorun files, after your installer if you have one (set the installer to Wait for this autorun file to close).
- Test it on your own PC.
The shortcut is created on the current user's desktop, including a desktop kept in OneDrive, and no administrator rights are needed.
What happened to the VBScript version?
Older answers used a .vbs file. Microsoft is removing VBScript from Windows (on Windows 11 it is already an optional feature that is being phased out), so a .vbs file may not run on new PCs. The batch file above uses PowerShell, which is part of every Windows 10 and 11 PC.