RELATED: How to Make Windows Clear Your Page File at Shutdown (and When You Should) And definitely back up the Registry (and your computer!) before making changes. That said, if you’ve never worked with it before, consider reading about how to use the Registry Editor before you get started. This is a pretty simple hack and as long as you stick to the instructions, you shouldn’t have any problems. Standard warning: Registry Editor is a powerful tool and misusing it can render your system unstable or even inoperable. In that case, there’s not much you can do besides shrinking the size of the page file. If your computer is managed by an IT department, they may have enabled this option for a reason. The encryption will prevent an attacker from examining your page file while the computer is shut down. However, you don’t need this option if your hard drive is encrypted (which you should do if you haven’t already). How long it takes depends how large the page file is and how fast your hard drive is. Your computer may take several minutes to shut down while Windows erases the page file, if this option is enabled. This erases everything in the page file, ensuring no sensitive data is stored where someone could access it by removing the computer’s hard drive and examining the paging file. Windows has a hidden option-disabled by default-to clear the paging file at shutdown. Windows uses a paging file, also known as a page file, as additional virtual memory.
RELATED: What Is the Windows Page File, and Should You Disable It? bat batch file.Ensure Windows Isn’t Clearing Your Page File at Shutdown
Using Notepad, add these four lines of code to a blank file, then save the file as a. The fourth line of code, shutdown -s, is the command to shut down Windows and the computer. However, if desired, press any key on the keyboard to skip the timer and immediately execute the next line of code. Using the timeout command, a countdown is displayed to let you know how much time is left before shutting down. The %timer% after timeout is the variable storing the numeric value, the number of seconds, entered by the user, for which Windows waits. The third line of code, timeout %timer%, is the command telling Windows to wait a period of time before executing the next line of code. Without the /p switch, the timer variable would be assigned the text after the equal sign, and no user prompt would show. The /p switch makes the prompt appear, with the text between the quotes after the equal (=) sign. The set command initializes the variable, timer in our code, and assigns the value entered by the user to that variable. ", is the command that allows the user to define the timer period. The second line of code, set /p timer= ". Set /p timer= "Enter the desired shut down timer in seconds: " The following example code can automatically shut down your computer-based on a timer defined by the user. Shut down the computer after a user-defined timeĪ script to shut down a Windows computer after a user-defined time consists of four lines of code. Using Notepad, add these three lines of code to a blank file, then save the file as a. The third line of code, shutdown -s, is the command to shut down Windows and the computer. However, you can press any key on the keyboard to skip the rest of the timer and immediately execute the next line of code. Using the timeout command, a countdown is displayed on the command line window, showing you how much time is left before the computer shuts down. You can set this value to your desired wait period.
The number after timeout is the amount of time, in seconds, that Windows waits. The second line of code, timeout 30, is the command telling Windows to wait a time before executing the next line of code.
Using off keeps the command line window clean. The first line of code, off, stops the echoing of commands in the Windows command line window. The following example code can automatically shut down your computer. Shut down the computer after a pre-defined timeĪ script to shut down a Windows computer after a pre-defined time consists of three lines of code.