0

I have a very simple .bat file. It only has one line:

powercfg -h off

What this does is turn off the computer's ability to hibernate. It works fine when I double click the file. I can confirm this by going into the command prompt and typing "powercfg /a", which shows me that hibernate is indeed off. The problem is that this batch file doesn't seem to be running at logon even though it's in my Startup folder.

I've tested it by turning hibernate on using the command prompt ("powercfg -h on") and then actually putting my computer into hibernation. Then I turn it back on and log in to Windows. But when I open a command prompt and type "powercfg /a" it shows me that hibernate is still on. It seems the batch file doesn't run at logon even though it is in my Startup folder.

I've also tried making it run from a task scheduled to run at logon, but that didn't work either.

2 Answers2

0

Some ideas:

  1. Make sure you set the Start in and Program/script options of the batch file correctly.
  2. If (1) doesn't work then try moving the .bat file to a directory with basic permissions.
  3. Try to schedule the execution of the batch file like this cmd /c "c:\path\batch.bat"

Also take a look at this: Batch runs manually but not in scheduled task.

Community
  • 1
  • 1
manlio
  • 18,345
  • 14
  • 76
  • 126
0

I got it to work using Task Scheduler. The problem was that I was using the trigger "At log on," when I should have chosen "On workstation unlock."

It's obvious to me now, but I didn't think of it at the time: hybernating didn't actually log me off, it only locked me out.