Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 664
Artisan Avatar asked Apr 12 '14 23:04

Artisan


3 Answers

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

like image 126
tony bd Avatar answered Nov 20 '22 21:11

tony bd


check the box

Just check that box as you set up the task and you are all set!

like image 25
Isaiah Taylor Avatar answered Nov 20 '22 21:11

Isaiah Taylor


Place the full path to the command or bat file into the registry under HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce

It will run under the system account

like image 2
Stormy Avatar answered Nov 20 '22 21:11

Stormy