- <#
- .SYNOPSIS
- This script creates a shortcut to Notepad on the Desktop
- .DESCRIPTION
- This script creates a Wscript.shell item, then creates
- a shortcut on the desktop to Notepad.exe.
- .NOTES
- File Name : New-Shortcut.ps1
- Author : Thomas Lee - tfl@psp.co.uk
- Requires : PowerShell Version 2.0
- .LINKS
- This post is a re-implementation of an MSDN Script
- http://msdn.microsoft.com/en-us/library/0ea7b5xe%28VS.85%29.aspx
- Posted to Powershell Scripts Blog
- HTTP://Pshscripts.blogspot.com
- .EXAMPLE
- Left as an exercise for the reader
- #>
- # create wscript object
- $WshShell = New-Object -com Wscript.Shell
- #Get Desktop location
- $Desktop = $WshShell.SpecialFolders.item("Desktop")
- # create a new shortcut
- $ShellLink = $WshShell.CreateShortcut($Desktop + "\Shortcut Script.lnk")
- $ShellLink.TargetPath = $WScript.ScriptFullName
- $ShellLink.WindowStyle = 1
- $ShellLink.Hotkey = "CTRL+SHIFT+F"
- $ShellLink.IconLocation = "notepad.exe, 0"
- $ShellLink.Description = "Shortcut Script"
- $ShellLink.WorkingDirectory = $Desktop
- #Save the link to the desktop
- $ShellLink.Save()
This blog contains PowerShell scripts, more PowerShell scripts and still more PowerShell scripts. Occasionally you may see some organisational posts.
Monday, 14 February 2011
New-Shortcut.ps1
Subscribe to:
Post Comments (Atom)
2 comments:
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?
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 v-saraec@microsoft.com
Post a Comment