In this post, we are going to see various shortcut tips related to PowerShell. Initially, we are going to see how to create a shortcut using the built-in shortcut command-let. Then we will move on to other interesting things that we can do using the create shortcut command-let.
- 6 Steps to create a shortcut in PowerShell.
- 3 Steps to create PowerShell shortcut to ShutDown Computer.
People also search for:
6 Steps to create a shortcut in PowerShell:
- Create variables to store the location of the executable and the destination location of the shortcut. Note that Event Viewer is located in System 32.
- Create a new WScript.Shell object.
- Pass the shortcut location and target file path to the WScript.Shell object.
- Save the shortcut.
- The code on the shell will look as follows.
- The created shortcut is shown in the image.
3 steps to create PowerShell Shortcut to Shutdown computer:
We can take the shortcut solution to the next level using the shutdown command. We will create a Microsoft Edge icon on the Desktop. We will add a command to the icon such that on, clicking it, the system will shut down. We have demonstrated it below.
- We need the Microsoft Edge icon. We can right-click the below icon and use save as option to save it to the Downloads folder. Please note that you have to save it to the Downloads folder.
- Open the PowerShell terminal and enter the following script.
- Try out the icon and see how the computer shuts down.
If you have completed the above steps correctly, you will be able to shut down the computer by clicking the edge icon.
It is very easy to create a shortcut using PowerShell. We use WScript.Shell’s create shortcut object to create a custom shortcut. In the first part, we learned how to create a shortcut using a few simple steps. In the second part, we created a shortcut that helps us shut down the computer using the shortcut.
If you want more such interesting posts, please stay tuned to TecKangaroo.