A standalone, dark-mode-aware Windows Forms GUI utility for creating .lnk Desktop shortcuts for PowerShell (.ps1) scripts—supporting both Windows PowerShell 5.1 and PowerShell 7.x (pwsh.exe), native Windows icon browsing with live preview, UAC elevation flag patching, and completely windowless background execution.
Tip: Looking for full PowerShell Gallery discovery, publishing, script updates, and integrated shortcut creation in one suite? Check out PSGallery-Manager (GitHub).
- PowerShell Gallery (Latest): https://www.powershellgallery.com/packages/create_desktop_shortcut
- PowerShell Gallery (v1.1.0): https://www.powershellgallery.com/packages/create_desktop_shortcut/1.1.0
- GitHub Repository: https://github.com/2civics/PowerShell-Desktop-Shortcut-Creator
- Companion Suite (
PSGallery-Manager): https://www.powershellgallery.com/packages/PSGallery-Manager
- Dual Runtime Support (PS 5.1 & PS 7.x): Target either Windows PowerShell 5.1 (
powershell.exe) or PowerShell 7.x (pwsh.exe). Automatically detects MSI and MSIX (WindowsApps) installations and offers a one-click background installer (wingetwith GitHub.msifallback) if PowerShell 7 is not installed. - Runtime-Aware Argument Builder: Automatically injects
-STAonly when targeting Windows PowerShell 5.1 (preventing invalid-argument crashes in PowerShell 7) and updates the live command preview as you toggle options. - Native Shell Icon Picker & Live Preview: Browse icons inside
.ico,.exe, or.dllfiles via Choose Icon..., jump straight intoshell32.dllvia Windows Icons..., or reset to the active PowerShell host icon with a live 32×32 preview. - Windowless Background Execution (
Hidden): Selecting Hidden adds-WindowStyle Hidden, configures the.lnkto start minimized (preventing console flash), and automatically disables-NoExitso background processes do not stay orphaned. - Run as Administrator (
.lnkElevation Patching): Sets theSLDF_RUNAS_USERbit (0x20at byte0x15) directly on the generated.lnkfile so Windows prompts for UAC elevation on launch. - Runtime-Preserving Self-Elevation & Hidden Host Console: Automatically elevates to Administrator in the same PowerShell runtime (
powershell.exeorpwsh.exe) that launched it and hides its own console window via Win32ShowWindow. - Windows 11 Dark / Light Mode: Automatically matches your Windows app theme (
AppsUseLightTheme) with a DWM dark title bar and an in-app toggle button.
- Operating System: Windows 10 or Windows 11
- PowerShell: Windows PowerShell 5.1 (built-in) or PowerShell 7.x (
pwsh.exe) - Privileges: Administrator (the script automatically requests UAC elevation on startup)
Open PowerShell and run:
Install-Script -Name create_desktop_shortcut -ForceTo update an existing installation to the latest version:
Update-Script -Name create_desktop_shortcut -ForceTo download the .ps1 file to a local folder using Save-Script:
Save-Script -Name create_desktop_shortcut -Path "$env:USERPROFILE\Downloads"Or download create_desktop_shortcut.ps1 directly from the GitHub Releases page.
If your PowerShell Scripts directory is in your $env:PATH, launch the utility from any terminal or Run prompt:
create_desktop_shortcut.ps1Or run it directly by path:
& "$env:ProgramFiles\WindowsPowerShell\Scripts\create_desktop_shortcut.ps1"- PowerShell Script (
.ps1): Click Browse... and select the target.ps1script. The Desktop shortcut name populates automatically from the script filename. - Shortcut Icon: Keep the default PowerShell icon, click Choose Icon... to pick from any
.ico,.exe, or.dll, or click Windows Icons... to browseshell32.dll. - PowerShell Mode: Choose PowerShell 5.1 (
powershell.exe) or PowerShell 7.x (pwsh.exe). If PowerShell 7 is selected and not installed, the tool prompts to install it automatically. - Launch Options:
- Run as Administrator: Triggers a UAC prompt whenever the shortcut is launched.
- Keep PowerShell window open (
-NoExit): Keeps the console open after script completion (disabled automatically when Window is set to Hidden). - Bypass Execution Policy: Adds
-ExecutionPolicy Bypass(enabled by default). - Window: Choose Normal, Minimized, Maximized, or Hidden.
- Script Arguments: Append any parameters passed directly to your
.ps1script.
- Create Shortcut: Verify the generated command in Shortcut Target Command Preview and click Create Shortcut to save
<Name>.lnkto your Desktop.
- Running scripts is disabled on this system:
Allow locally signed/installed scripts for your user account:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
- Downloaded
.ps1blocked by Windows Mark-of-the-Web: If you downloaded the script manually in a browser, unblock it before running:Unblock-File -Path .\create_desktop_shortcut.ps1
- Added PowerShell 5.1 and PowerShell 7.x (
pwsh.exe) mode selection withGet-Pwsh7Infodetection (InstalledVersionsregistry keys,App Paths, MSI, and MSIXWindowsAppspaths) and automatic background installation (winget+ GitHub.msifallback). - Added the Windows Icons... button (
shell32.dll) alongside Choose Icon... and Reset. - Conditionally injects
-STAonly for Windows PowerShell 5.1 during self-relaunch and shortcut creation. - Preserved the active PowerShell host executable across UAC self-elevation via
(Get-Process -Id $PID).Path. - Fixed
Add-Typeassembly resolution on PowerShell 7 (.NET 8+) and added forced foreground window activation (SW_SHOW+SetForegroundWindow).
- Hid the PowerShell console window when running this utility via hidden relaunch flags and Win32
ShowWindowfallback. - Added a Hidden option to the Window dropdown to execute target scripts with
-WindowStyle Hidden(and start minimized to prevent console flash). - Automatically disables
-NoExitwhen Hidden is selected to prevent orphaned background PowerShell processes. - Updated the live command preview to reflect
-WindowStyle Hiddendynamically.