How to create Shutdown shortcut in windows terminal using PowerShell

This article will show us how we can use PowerShell inside the Windows Terminal to create a shutdown shortcut easily.

Windows Terminal Explained:

Windows Terminal is the latest terminal in windows 10. Windows Terminal is used for working with command prompt, PowerShell, windows subsystem for Linux, bash, and many other terminals available on many different platforms. Windows Terminal is a very powerful tool that is built into Windows 10.

 

 

{Quickly Open} the [Microsoft Excel] in Windows 10!!

 

Script
Please note that it is not mandatory to have a Windows Terminal but we can use the script on the regular PowerShell terminal also.

We have split the article into two parts. In the first section, the script will work for everyone by just following the instructions and not modifying anything. If the first section does not work it is possible that the download file location did not properly resolve.  Therefore we will manually modify the script so that it has the full path to the shortcut icon file.

So we will see how we can shut down the computer using the shortcut created by PowerShell in the Windows Terminal.

Shutdown shortcut in Windows Terminal:

  1. Right-click the given icon and save it to the Downloads folder using the save as option.
    icon image
    icon image
  2. Launch the Windows Terminal.
  3. Copy paste the the script given below.
    Script
    $SourceFileLocation = “%windir%\System32\shutdown.exe”
    $ShortcutLocation = “C:\Users\$env:USERNAME\Desktop\Microsoft Edge.lnk”
    $WScriptShell = New-Object -ComObject WScript.Shell
    $Shortcut = $WScriptShell.CreateShortcut($ShortcutLocation)
    $Shortcut.TargetPath = $SourceFileLocation
    $Shortcut.IconLocation = “C:\Users\$env:USERNAME\Downloads\Microsoft-Edge.ico”
    $Shortcut.Arguments = “/s /t 0”
    $Shortcut.Save()
    created the shutdown short cut
    created the shutdown short cut

Once the script has finished executing we will see a Microsoft edge shutdown icon on the desktop.  We have successfully created a shutdown shortcut using the Windows Terminal.

Shutdown shortcut in Windows Terminal method 2:

  1. Download the icon by right-clicking and using the save as option.
    icon image
    icon image
  2. Launch Windows Terminal as usual.
  3. Copy-paste the below script into the terminal.
    Script
    $SourceFileLocation = “%windir%\System32\shutdown.exe”
    $ShortcutLocation = “C:\Users\$env:USERNAME\Desktop\Microsoft Edge.lnk”
    $WScriptShell = New-Object -ComObject WScript.Shell
    $Shortcut = $WScriptShell.CreateShortcut($ShortcutLocation)
    $Shortcut.TargetPath = $SourceFileLocation
    script part one
    script part one
  4. Go to the download location of the icon.
  5. Copy the address from the address bar.
  6. Insert the address in the full path of the icon path.
  7. Please note that you should not allow duplicate forward shashes.
  8. Paste the script with icons address path.
  9. Script
    $Shortcut.IconLocation = “<Insert path here>\Microsoft-Edge.ico”
    icon path in script
    icon path in script
  10. Copy and paste the below script.
    Script
    $Shortcut.Arguments = “/s /t 0”
    $Shortcut.Save()
    final part
    final part

Now if you go and check the the desktop you will see the shut down icon.  We have successfully created a shutdown shortcut using the Windows Terminal.

Tool for Blogger

Verdict:

Windows Terminal is the latest terminal for windows. It has many features that are necessary for a new generation terminal.

We are using PowerShell within the Windows Terminal to create a shutdown shortcut in windows.  If you have any doubts about the above step please ask us in the comments below.

Grab the latest information on Microsoft PowerShell, Teams, and other technologies at TecKangaroo.

Leave a Comment