Monday, 14 February 2011


  1. <# 
  3.    This script creates a shortcut to Notepad on the Desktop 
  5.    This script creates a item, then creates  
  6.    a shortcut on the desktop to Notepad.exe. 
  7. .NOTES 
  8.     File Name  : New-Shortcut.ps1 
  9.     Author     : Thomas Lee - 
  10.     Requires   : PowerShell Version 2.0 
  11. .LINKS 
  12.     This post is a re-implementation of an MSDN Script 
  14.     Posted to Powershell Scripts Blog 
  15.         HTTP:// 
  16. .EXAMPLE 
  17.    Left as an exercise for the reader 
  18. #> 
  20. # create wscript object 
  21. $WshShell = New-Object -com Wscript.Shell 
  23. #Get Desktop location 
  24. $Desktop  = $WshShell.SpecialFolders.item("Desktop"
  26. # create a new shortcut 
  27. $ShellLink                  = $WshShell.CreateShortcut($Desktop + "\Shortcut Script.lnk"
  28. $ShellLink.TargetPath       = $WScript.ScriptFullName 
  29. $ShellLink.WindowStyle      = 1 
  30. $ShellLink.Hotkey           = "CTRL+SHIFT+F" 
  31. $ShellLink.IconLocation     = "notepad.exe, 0" 
  32. $ShellLink.Description      = "Shortcut Script" 
  33. $ShellLink.WorkingDirectory = $Desktop 
  35. #Save the link to the desktop 
  36. $ShellLink.Save() 


skatterbrainz said...

It seems to me that the vast majority of PS examples on the web today are adaptations of VBscript or WMI. Why aren't there more examples of what PS can do that other script languages cannot do?

MicrosoftGirl said...

I work for Microsoft and I'm hiring for both PowerShell Dev's and PowerShell SDET's. I was wondering if you may know anyone interested in working at Microsoft in this capacity. I know that you have a great following when it comes to PowerShell. Any help or advice you can give would be greatly appreciated.

Please feel free to contact me at anytime or share my information. My email address is

Cindy Dy said...

I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement the concept. Thank you for the post.