Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to open a bat file as soon as the computer powers up and enters Windows. This bat file needs internet connectivity. How can I bypass logging-in or automate logging-in or something like that - and then how can I start the .bat file? It is an administrator account. I guess the latter part could be done using Windows Scheduler - but if there's a Registry setting or something easier like that, I would prefer it.

share|improve this question

The Task Scheduler is probably the easiest way to do this. Here's a walkthrough: Schedule a task

Since you mentioned registry editing, I'm guessing you prefer a text-based interface. In this case use the schtasks command. There is another command called at, but it can't schedule a task at system startup.

All of these commands use the same subsystem, so a task created using schtasks will show up in Task Scheduler.

share|improve this answer
Schedule a task didn't run the task =/ When I set it to run as on demand, then it ran, but it defeats the purpose. – TPR Nov 30 '11 at 12:03

Create a Batch script with registry file to do a RunOnce


:: This is the Batch Script that can be Located @ %sysetmdrive%\Runonce.bat
    -- Runonce script called by daily task scheduler --

      This calls another batch script to be scheduled at boot time.


@echo off

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY%\099 /V 1 /D "%SystemDrive%\resetpermissions.bat" /f

:: REM - HERE you can add multiple scripts called by runonce like this.

REG ADD %KEY%\099 /V 2 /D "%SystemDrive%\resetpermissions.bat" /f

ping -n 4 localhost >NUL
shutdown.exe /s /f /t 10

-- script --

Then use the task scheduler to do a task once a day -- i use a daily shutdown script for multiple computers. and to reset rights every day.

instead of just using %systemroot%\system32\shutdown.exe -- i Use the script to complete addition tasks at shutdown instead of creating task scheduler

In the task scheduler run this script as user: SYSTEM or ie: "NT Authority\System" this will give the script system rights or above admin rights, with the ability to complete the task before the user logs in.

This Runonce key starts before user logs into windows. and will can delay the windows explorer from opening till the script has completed. so even if a user does not logon at welcome screen the script will run anyway.

share|improve this answer
Sorry, but runonce starts after logging in, and only as admin. – kinokijuf Nov 26 '11 at 16:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .