Batch scripts that require administrator rights — for example, one that starts the Windows Time service and forces a clock resync — will never execute from the Startup folder or Task Manager's Startup Apps list. Those launch points start programs with your standard, non-elevated user token, and User Account Control silently blocks the elevation request. The dependable way to run an elevated batch file at boot is to register it as a Task Scheduler task with Run with highest privileges enabled and an At startup trigger.
Why the entry shows "Enabled" but nothing happens
Task Manager's Startup tab is only a view of Startup-folder shortcuts and Run registry keys. Everything launched from there inherits the unelevated token that Explorer is using at logon. When such a process touches something privileged — starting a service with net start w32time, or changing the system clock with w32tm /resync — Windows must show a UAC consent prompt. During logon there is no reliable way to display or answer that prompt, so the request is refused and the script exits without any visible error. The startup entry still reads "Enabled"; the script simply does nothing.
Schedule the script with elevation
Task Scheduler is the built-in mechanism designed for unattended elevated launches. Set the task up like this:
- Press
Win+R, typetaskschd.msc, and press Enter. - In the right-hand pane choose Create Task — not Create Basic Task, whose wizard hides the elevation option.
- On the General tab, name the task and tick Run with highest privileges. If the job should run before anyone signs in, also select Run whether user is logged on or not (Windows will store your password); otherwise the default is fine.
- On the Triggers tab, add a trigger that begins At startup, with a delay of 30–60 seconds so the network stack and the time service are ready before the script fires.
- On the Actions tab, choose Start a program. Set Program to
C:\Windows\System32\cmd.exeand Arguments to/c "C:\Scripts\resync-time.bat", using your script's real path. - On the Conditions tab, clear Start the task only if the computer is on AC power. On a portable machine this default condition otherwise stops the task whenever it boots on battery.
- Click OK, then right-click the task and choose Run to test it immediately, and confirm your log file was written.
A one-line alternative: schtasks
If you prefer the command line, or want to deploy the same job to several machines, a single schtasks call creates the equivalent task:
schtasks /create /tn "Resync Clock" /tr "cmd /c C:\Scripts\resync-time.bat" /sc onstart /ru SYSTEM /rl highest /f
Running the task as SYSTEM sidesteps UAC entirely: that account already holds the rights to start services and set the clock, and no password has to be stored. Omit /ru SYSTEM if you would rather the task run under your own account with the full administrator token.
Make the script survive real-world conditions
- Log to a fixed path. A desktop path such as
C:\Users\you\Desktop\log.txtbreaks if the profile is redirected, moved into OneDrive, or cleaned by management policies. Use something likeC:\Logs\time-sync.logand create the folder first. - Expect the network to be late.
w32tm /resyncfails when no time server is reachable yet, which is common seconds after boot — another reason for the trigger delay. Adding/forcemakes the command push through more persistently. - Tolerate a running service.
net start w32timeprints a harmless "already running" message if the service is up; appending2>&1to both lines captures errors in the log as well.
net start w32time >>C:\Logs\time-sync.log 2>&1
w32tm /resync /force >>C:\Logs\time-sync.log 2>&1
Fix the cause, not just the symptom
A laptop that forgets the time whenever it is unplugged almost always has a dead CMOS/RTC backup battery on the motherboard (on some models it lives inside the main battery pack). Replacing that coin cell restores the hardware clock and makes the whole workaround unnecessary. In the meantime, set the Windows Time service to start automatically; once it and a time server are reachable, Windows will keep the clock corrected on its own.
Frequently Asked Questions
Can I just tick "Run as administrator" on a Startup-folder shortcut?
The compatibility flag on a shortcut requests elevation at launch, but during logon there is no interactive desktop ready to display the UAC prompt, so the request fails or is skipped. Task Scheduler exists precisely for unattended elevated launches.
What is the difference between "Run with highest privileges" and running as SYSTEM?
"Run with highest privileges" runs the task under your own account but with the full administrator token. SYSTEM is a separate built-in account with machine-level rights; it needs no stored password and is never blocked by UAC. For service and time tasks, either works.
Why does the task run when I click Run but not at boot?
Check the AC-power condition on the Conditions tab and clear it, confirm the trigger really is "At startup" rather than "At log on", and verify the trigger delay is not set to an hour by mistake.
How do I see whether the task actually executed?
Select the task and read Last Run Result — 0x0 means success. Enable history on the History tab for a full timeline, and inspect the log file your script writes.
The task never runs when the laptop is on battery. Why?
By default Task Scheduler starts tasks only on AC power. Open the task's Conditions tab and untick "Start the task only if the computer is on AC power".
Does the script itself still need an administrator flag?
No. When Task Scheduler launches it with highest privileges or as SYSTEM, everything the script starts inherits those rights; per-shortcut compatibility settings become irrelevant.