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
- Pick what should happen and, if you like, how quiet counts as "finished".
- Download the script and start it once your downloads or updates are running.
- 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:
- Click Copy code, open Notepad and paste.
- Choose File › Save as. Set Save as type to All files (*.*). This step matters: if it stays on "Text documents", Notepad quietly adds
.txt. - Type a name ending in
.bat, likemy-script.bat, and save. You can also type the name in quotes,"my-script.bat", which forces that exact name even on "Text documents". - 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
| Command | What it does |
|---|---|
Get-NetAdapterStatistics | Reads how many bytes each network connection has received so far. |
Start-Sleep -Seconds 10 | Checks every 10 seconds; the difference between readings is the current download speed. |
$quiet -lt $need | Keeps waiting until the speed has stayed low for the whole quiet time. Any burst of downloading resets it. |
shutdown /s /t 60 | Shuts down after Windows' 60-second notice. /r restarts instead. |
shutdown /h | Hibernates: 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
- Shutdown Timer: Shut down, restart, hibernate or lock the PC after a delay.
- Shut Down When a Program Closes: Turn the PC off once a render, export, installer or game update closes.
- Download Time Calculator
- All batch scripts