Batch Scripts

Shut Down When Downloads Finish

Leave a big download or game update running and walk away: the PC turns itself off once your internet goes quiet.

 

Windows only. Read the code before running any script you download. Your browser or Windows SmartScreen may warn about .bat files; choose "Keep" / "More info › Run anyway" if you trust it.

Keeps this tool on this device so it works without internet, even after a refresh.

Had fun, or did this help? I’d appreciate any donation :) Not needed, but money buys temporary happiness at least lol

What it does

A shutdown timer is a guess: set it too short and the download is cut off, too long and the PC runs all night for nothing. Steam, Battle.net, Epic and browsers don't all have a reliable "shut down when done" option, and the ones that exist only watch their own downloads.

This script watches how fast data is coming in on all your network connections. When it stays below a speed you choose (300 KB/s by default) for a number of minutes in a row, downloads are clearly done, and it shuts the PC down, restarts or hibernates it. Shutdown and restart come with Windows' usual 60-second warning, so you can still cancel.

How to use Shut Down When Downloads Finish

  1. Pick what should happen and, if you like, how quiet counts as "finished".
  2. Download the script and start it once your downloads or updates are running.
  3. Leave the window open. Close it any time to cancel.

Making the .bat file yourself

The download button already gives you a ready-to-run .bat file. If you'd rather copy the code, or the download gets blocked, you can make the file yourself in Notepad:

  1. Click Copy code, open Notepad and paste.
  2. Choose File › Save as. Set Save as type to All files (*.*). This step matters: if it stays on "Text documents", Notepad quietly adds .txt.
  3. Type a name ending in .bat, like my-script.bat, and save. You can also type the name in quotes, "my-script.bat", which forces that exact name even on "Text documents".
  4. Check the file's icon: a .bat file shows a gear-window icon, not a notepad page. Double-click it to run.
My file ended up as script.bat.txt and opens in Notepad. How do I fix it?

Windows hides file extensions by default, so the file looks like script.bat but is really script.bat.txt. Turn extensions on: in File Explorer, choose View › Show › File name extensions (Windows 11) or tick File name extensions on the View tab (Windows 10). Then rename the file, delete the .txt at the end, and click Yes when Windows asks if you're sure you want to change the extension.

How it works

CommandWhat it does
Get-NetAdapterStatisticsReads how many bytes each network connection has received so far.
Start-Sleep -Seconds 10Checks every 10 seconds; the difference between readings is the current download speed.
$quiet -lt $needKeeps waiting until the speed has stayed low for the whole quiet time. Any burst of downloading resets it.
shutdown /s /t 60Shuts down after Windows' 60-second notice. /r restarts instead.
shutdown /hHibernates: saves everything to disk and powers off.

Shut Down When Downloads Finish FAQ

My download pauses sometimes. Will it shut down too early?

Only if the speed stays under the limit for the full quiet time. Raise the minutes to 10 or 15 if your launcher pauses between files.

Does background traffic keep the PC on?

Streaming music or video, cloud sync and other downloads all count as traffic, so pause them if they're faster than the limit.

Will it notice uploads?

No, it only watches incoming data, which is what downloads and updates are.

How do I run a .bat file?

Double-click it. To see or edit the code, right-click it and choose Edit (or open it in Notepad). Scripts that need administrator rights say so; for those, right-click › Run as administrator.

Is this script uploaded or tracked?

No. The code is built in your browser from the settings above and downloaded straight to your PC.

Related