in message
how can I make my computer turn off automatically at midnight.
Preferably
with a password.
Schedule an event in Task Scheduler to run the 'shutdown.exe' command.
In a DOS shell, run 'shutdown /?' to see what parameters it takes. When
you define the event, you will be asked for your login password. If you
are a limited account and need to run the program under an admin account
then specify Administrator as the account and specify its login
password. All scheduled events run under *some* account and use its
password to authenticate the program can run under that account.
As an alternate, and rather than a specific time but instead after a
period of inactivity, you could use power options to put the computer
into hibernation mode after the computer has been idle for too long.