Create a Desktop Shortcut with PowerShell (WScript.Shell)

Generate .lnk shortcut files from a script using the WScript.Shell COM object and CreateShortcut.

WindowsdesktopFilescompowershellLow risk
Use New-Object -ComObject WScript.Shell, call CreateShortcut('...\MyTool.lnk'), set TargetPath, then Save().

01Command

Command
$ $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

RiskLow risk

04Undo

Undo
$ Remove-Item "$env:USERPROFILE\Desktop\MyTool.lnk"

05Sources

  • Create a Shortcut - SS64
    SS64 · technical · 2026-09-17
    Evidence: Shows the CreateShortcut pattern used from VBScript/PowerShell to write .lnk files.

Last verified: 2026-09-18 · Category: Files & Folders

06Related solutions