Create a Desktop Shortcut with PowerShell (WScript.Shell)
Generate .lnk shortcut files from a script using the WScript.Shell COM object and CreateShortcut.
01Command
$ $ws = New-Object -ComObject WScript.Shell
$s = $ws.CreateShortcut("$env:USERPROFILE\Desktop\MyTool.lnk")
$s.TargetPath = 'D:\Tools\mytool.exe'
$s.WorkingDirectory = 'D:\Tools'
$s.Save()02What it does
Windows has no native cmdlet for shortcuts, but the WScript.Shell COM object has existed since the 90s and works fine from PowerShell. CreateShortcut on a non-existent path returns a fresh shortcut object you fill in — TargetPath for what it launches, WorkingDirectory so relative paths resolve, plus optional Arguments, IconLocation and WindowStyle. Point it at a folder path to make a folder shortcut; only .lnk and .url extensions are valid for CreateShortcut.
03Risk
04Undo
$ Remove-Item "$env:USERPROFILE\Desktop\MyTool.lnk"05Sources
- Create a Shortcut - SS64Evidence: Shows the CreateShortcut pattern used from VBScript/PowerShell to write .lnk files.
Last verified: 2026-09-18 · Category: Files & Folders
06Related solutions
Diagnose NTFS file system errors and bad sectors on any volume — including the system drive while Windows is running — before committing to a repair.
Robocopy is Windows' built-in robust file copier: use /MIR to keep a destination folder as an exact one-way mirror of a source, resumable and restartable.
Search inside text files and logs with regex, returning file, line number and match.