Skip to content

About

Dark-mode Windows Forms GUI for creating Desktop shortcuts (.lnk) for PowerShell 5.1 & 7.x scripts with custom shell icons, UAC elevation, and windowless execution.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

PowerShell Desktop Shortcut Creator (create_desktop_shortcut)

PowerShell Gallery Version PowerShell Gallery Downloads Platform PowerShell

A standalone, Windows 11 Fluent WPF GUI utility for creating .lnk Desktop shortcuts for PowerShell (.ps1) scripts, supporting Windows PowerShell 5.1 and PowerShell 7.x (pwsh.exe), adaptive Auto/Dark/Light themes, a visual icon grid picker with live preview, drag-and-drop, UAC elevation patching, and completely windowless background execution.

Screenshot 2026-11-29 073453

Tip: Looking for full PowerShell Gallery discovery, publishing, script updates, and integrated shortcut creation in one suite? Check out PSGallery-Manager (GitHub).


Links


Features

  • 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 (winget with GitHub .msi fallback) if PowerShell 7 is not installed.
  • Runtime-Aware Argument Builder: Automatically injects -STA only 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 .dll files via Choose Icon..., jump straight into shell32.dll via 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 .lnk to start minimized (preventing console flash), and automatically disables -NoExit so background processes do not stay orphaned.
  • Run as Administrator (.lnk Elevation Patching): Sets the SLDF_RUNAS_USER bit (0x20 at byte 0x15) directly on the generated .lnk file 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.exe or pwsh.exe) that launched it and hides its own console window via Win32 ShowWindow.
  • Windows 11 Dark / Light Mode: Automatically matches your Windows app theme (AppsUseLightTheme) with a DWM dark title bar and an in-app toggle button.

Requirements

  • 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)

Installation

Option 1: Install from PowerShell Gallery (Recommended)

Open PowerShell and run:

Install-Script -Name create_desktop_shortcut -Force

To update an existing installation to the latest version:

Update-Script -Name create_desktop_shortcut -Force

Option 2: Save or Download Without Installing

To 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.


Usage

If your PowerShell Scripts directory is in your $env:PATH, launch the utility from any terminal or Run prompt:

create_desktop_shortcut.ps1

Or run it directly by path:

& "$env:ProgramFiles\WindowsPowerShell\Scripts\create_desktop_shortcut.ps1"

Creating a Shortcut

  1. PowerShell Script (.ps1): Click Browse... and select the target .ps1 script. The Desktop shortcut name populates automatically from the script filename.
  2. Shortcut Icon: Keep the default PowerShell icon, click Choose Icon... to pick from any .ico, .exe, or .dll, or click Windows Icons... to browse shell32.dll.
  3. 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.
  4. 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 .ps1 script.
  5. Create Shortcut: Verify the generated command in Shortcut Target Command Preview and click Create Shortcut to save <Name>.lnk to your Desktop.

Troubleshooting

  • Running scripts is disabled on this system: Allow locally signed/installed scripts for your user account:
    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
  • Downloaded .ps1 blocked 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

Changelog

What's New in v2.0.0

Added

  • WPF Fluent Design UI: Rebuilt the entire interface from WinForms to WPF XAML using an INotifyPropertyChanged ThemeManager, Segoe Fluent Icons, rounded cards, slim scrollbars, placeholder watermarks, and native high-DPI scaling with WorkArea clamping.
  • Adaptive Auto | Dark | Light Theme Sync: Replaced the single dark/light toggle with a segmented pill control that syncs live with Windows theme changes (SystemEvents.UserPreferenceChanged) and applies native DWM dark title bars and rounded window corners.
  • Built-In Visual Icon Grid Picker: Added an interactive icon browser with index filtering and one-click presets for imageres.dll, shell32.dll, ddores.dll, and pifmgr.dll, alongside live icon preview.
  • Drag-and-Drop Support: Drop any .ps1 script onto the window to populate the script path and shortcut name, or drop .ico, .exe, or .dll files to set the icon source.
  • -Theme Startup Parameter: Added optional -Theme Auto|Dark|Light support, preserved automatically across UAC/STA relaunches.

Changed

  • Zero WinForms / System.Drawing Dependencies: Migrated file dialogs to Microsoft.Win32.OpenFileDialog, background PowerShell 7 installation timers to WPF DispatcherTimer, and icon extraction to native Imaging.CreateBitmapSourceFromHIcon.
  • PowerShell 7.x Add-Type Compatibility: Explicitly referenced WPF assemblies during inline C# compilation so the script compiles cleanly on both Windows PowerShell 5.1 and PowerShell 7.x (.NET 8+).

What's New in v1.2.1

  • Fixed PowerShell 7.x High-DPI & Multi-Resolution Rendering: Configured DpiUnawareGdiScaled high-DPI mode, DPI AutoScale baselines, dynamic ComboBox item heights, and WorkingArea screen clamping so the UI scales cleanly across resolutions and Windows display scales.
  • Responsive 3-Zone Layout: Replaced fixed pixel coordinates with TableLayoutPanel/FlowLayoutPanel containers, pinned the command preview and action buttons at the bottom, and auto-sized initial form height to eliminate side scrollbars on startup while supporting AutoScroll on smaller displays.

What's New in v1.2.0

  • Aligned PowerShell 5.1 / 7.x Integration: Aligned PowerShell 5.1 / 7.x mode selection, Get-Pwsh7Info detection, inline status indicator, and background winget/GitHub MSI installation with PSGallery-Manager.
  • Added Windows Icon Picker: Added the Windows Icons... button (shell32.dll) alongside Choose Icon... and Reset.
  • Preserved Host Executable Across Elevation: Preserved the active PowerShell host executable across UAC self-elevation via (Get-Process -Id $PID).Path and restricted -STA to Windows PowerShell 5.1.
  • Fixed PowerShell 7 Assembly Compilation: Fixed Add-Type compilation on PowerShell 7 (.NET 8+) by dynamically resolving loaded assembly locations for -ReferencedAssemblies.
  • Improved Window Activation & COM Cleanup: Forced foreground window activation (SW_SHOW + SetForegroundWindow) on form startup and ensured deterministic COM release before binary UAC patching.

What's New in v1.1.0

  • Hidden Console Window on Launch: Hid the PowerShell console window when running this utility via hidden relaunch flags and Win32 ShowWindow fallback.
  • Added Hidden Window Shortcut Option: Added a Hidden option to the Window dropdown to create shortcuts that execute target scripts with -WindowStyle Hidden (and start minimized to prevent window flash).
  • Prevented Orphaned Background Processes: Automatically disables -NoExit when Hidden is selected to prevent orphaned background PowerShell processes.
  • Dynamic Command Preview Updates: Updated the live command preview to reflect -WindowStyle Hidden dynamically.

About

Dark-mode Windows Forms GUI for creating Desktop shortcuts (.lnk) for PowerShell 5.1 & 7.x scripts with custom shell icons, UAC elevation, and windowless execution.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages