Skip to content

Instantly share code, notes, and snippets.

@ikupenov
Created October 27, 2025 22:28
Show Gist options
  • Select an option

  • Save ikupenov/09484c285612fe89cdb732d0d36c2b2a to your computer and use it in GitHub Desktop.

Select an option

Save ikupenov/09484c285612fe89cdb732d0d36c2b2a to your computer and use it in GitHub Desktop.
Recovers apps in Windows start menu
# Define Start Menu folder and create a dedicated subfolder
$startMenu = "$env:APPDATA\Microsoft\Windows\Start Menu\Programs"
$customFolder = Join-Path $startMenu "Recovered From Installed Apps"
if (-not (Test-Path $customFolder)) {
New-Item -ItemType Directory -Path $customFolder | Out-Null
}
# Get all registered apps (same list as Settings > Installed apps)
$apps = Get-StartApps
foreach ($app in $apps) {
try {
$name = $app.Name # Friendly display name (e.g. "Riot Client")
$appId = $app.AppID # Target (exe path or AppX ID)
# Clean up the name for use as a shortcut filename
$safeName = ($name -replace '[\\/:*?"<>|]', '')
$shortcutPath = Join-Path $customFolder "$safeName.lnk"
if (-not (Test-Path $shortcutPath)) {
$WshShell = New-Object -ComObject WScript.Shell
$shortcut = $WshShell.CreateShortcut($shortcutPath)
if (Test-Path $appId) {
# If AppID is a real file path (desktop app), use it directly
$shortcut.TargetPath = $appId
} else {
# Otherwise (Store/UWP app), use explorer.exe with shell:AppsFolder\AppID
$shortcut.TargetPath = "explorer.exe"
$shortcut.Arguments = "shell:AppsFolder\$appId"
}
$shortcut.Save()
Write-Output "Created shortcut for $name"
}
} catch {
Write-Output "Failed to create shortcut for $($app.Name)"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment