How to create a StartMenu link on the Desktop with PowerShell
Introduction
With the interface changes to Windows 8 and above we see the ease of adding shortcuts by dragging or right clicking on the StartMenu links and sending to the desktop diminished, but with PowerShell we can easily automate creating links to folders and applications. In this post we will see just how easy it is to create these links.
Code
The code is simple, we will need to create a wscript.shell ComObject then create a source and target variable and execute. Open Notepad, PowerShell ISE or your favorite editor (NotePad++) and copy in the below code. In this example we will be creating a link for all users to the StartMenu.
$objShell = New-Object -ComObject ("WScript.Shell") $objShortCut = $objShell.CreateShortcut("C:\Users\Public\Desktop\" + "\StartMenu.lnk") $objShortCut.TargetPath="C:\ProgramData\Microsoft\Windows\Start Menu\Programs" $objShortCut.Save()
Save and execute the code and magically a new link appears on the Desktop to the StartMenu. Quick and simple! By changing two lines in for our source and target we can use this simple script to create links to any folder or application.
Conclusion
As we can see with this PowerShell example we can make simple changes to the code to create shortcut links to programs and folders easily with PowerShell.
Leave a Reply