用chart-GPT写的一个脚本,太厉害了 感觉要失业了
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
$currentTime = Get-Date
$secondsUntilNext3Min = (3 - $currentTime.Minute % 3) * 60 - $currentTime.Second
$next3MinTime = $currentTime.AddSeconds($secondsUntilNext3Min)
while ($true) { $timeToWait = $next3MinTime - (Get-Date) if ($timeToWait.TotalSeconds -gt 0) { Start-Sleep -Seconds $timeToWait.TotalSeconds }
Start-Sleep -Seconds 1
$o = New-Object -ComObject wscript.shell $o.sendkeys("{SCROLLLOCK}{SCROLLLOCK}")
$currentTime = Get-Date
$secondsUntilNext3Min = (3 - $currentTime.Minute % 3) * 60 - $currentTime.Second
$next3MinTime = $currentTime.AddSeconds($secondsUntilNext3Min)
if ($currentTime.Hour -eq 18 -and $currentTime.Minute -ge 30) { Stop-Computer } }
|
摸鱼脚本。如果当前时间晚于下午6点,则脚本将关闭电脑。你可以通过运行 nohup ./script.sh & 命令将其作为后台进程运行,并使用 kill PID 命令停止它。