Last active
March 2, 2022 09:35
-
-
Save Icaruk/132f2076165c22ac1e58180a690e5d58 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Write-Host "Shutdown timer..." | |
$Horas = Read-Host -Prompt 'Hours (can be 0)' | |
$Minutos = Read-Host -Prompt 'Minutes' | |
$Segundos = 0 | |
if ($Horas -eq 0) { | |
$Horas = 0 | |
} | |
if ($Minutos -eq 0) { | |
$Minutos = 0 | |
$Segundos = 5 | |
} | |
$Segundos += [int]$Horas * 60 * 60 | |
$Segundos += [int]$Minutos * 60 | |
$Fecha = (Get-Date).AddSeconds($Segundos) | |
$FechaStr = $Fecha.ToString('HH:mm dd/MM/yyyy') | |
Write-Host "" | |
Write-Host -ForegroundColor red "Shutdown will be at $FechaStr" | |
Write-Host -ForegroundColor green Press CTRL+C to cancel. | |
Timeout /T $Segundos /nobreak | |
# Start-Sleep -Seconds $Segundos | |
Write-Host "Shutting down..." | |
Stop-Computer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment