Create PowerShell Shortcuts

by Apr 20, 2009

If you ever wanted to create shortcut icons on your Desktop, or in your programs menu, to quickly launch PowerShell, here is a way to do it:

function CreatePSShortcut {
$wshell = New-Object -comObject WScript.Shell
$path1 = $wshell.SpecialFolders.Item('Desktop')
$path2 = $wshell.SpecialFolders.Item('Programs')

$path1, $path2 | ForEach-Object {
$link = $wshell.CreateShortcut("$_PowerShell.lnk")
$link.TargetPath = 'powershell.exe'
$link.Description = 'launches Windows PowerShell console'
$link.WorkingDirectory = $home
$link.IconLocation = 'powershell.exe'


Of course, you can use this code template to create just about any shortcut you want. Simply adjust the Target and IconLocation properties to point to the program that the shortcut should launch.