Search code examples
windowsbatch-file

Run .bat file with administrator privilege at startup


I'm using Ubuntu and Windows on the same machine, and always have problem with incorrect time when booting into Windows, so I like to execute w32tm /resync at startup.

So I'm trying to put this command into a .bat file and place it in the startup folder, but this command requires administrator privilege, so please guide me what to do to make this work.

Thanks.

I'm using Windows 7 Ultimate edition.


Solution

  • Schedule it in Task Schedule and tick the required boxes for elevation or run it as system.