Skip to content

Instantly share code, notes, and snippets.

@tomshaw
Created June 13, 2025 13:19
Show Gist options
  • Save tomshaw/bf0134ff8f0ab8bfefc520ee4938c357 to your computer and use it in GitHub Desktop.
Save tomshaw/bf0134ff8f0ab8bfefc520ee4938c357 to your computer and use it in GitHub Desktop.
Useful PowerShell aliases to quickly shut down, restart, or sleep your Windows PC from the terminal.
# Shutdown immediately
function Shutdown-Now {
shutdown /s /f /t 0
}
Set-Alias sdnow Shutdown-Now
# Reboot immediately
function Reboot-Now {
shutdown /r /f /t 0
}
Set-Alias sdreboot Reboot-Now
# Sleep the computer
function Sleep-Now {
rundll32.exe powrprof.dll,SetSuspendState 0,1,0
}
Set-Alias sdsleep Sleep-Now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment