In the previous tip we created new shortcut files, and you have seen how the CreateShortcut() method provides methods to control almost any detail of a shortcut. Here’s the code again that creates a PowerShell shortcut on your Desktop:
$path = [Environment]::GetFolderPath('Desktop') | Join-Path -ChildPath 'myLink.lnk'
$scut = (New-Object -ComObject WScript.Shell).CreateShortcut($path)
$scut.TargetPath = 'powershell.exe'
$scut.IconLocation = 'powershell.exe,0'
That’s all to it: on your desktop there is now a new PowerShell link. Adjust the code above to create shortcuts to other applications and paths.
ReTweet this Tip!
Awesome! It works for me, more convinenient and easier to use. This PowerShell code creates shortcut that helps my Hawaii Remodeling files to complete faster than expected.
Powered by IDERA