On Windows 8.1, I am trying to start a program from a batch file which is called during startup and I want the program to run as Administrator. Here is what I do:
But it does not happen. There is a short "bleep" sound as if Windows is displaying a message asking to confirm the program should run as Administrator but nothing is visible on the screen.
a) If I flag the shortcut & exe NOT to run as admin, then the EXE is launched.
b) If I flag the shortcut & exe to run as admin, then the EXE is not launched.
c) If I flag the shortcut to NOT to run as admin and the EXE to run as admin then the EXE is launched but it does not run as administrator.
d) Startup shortcut to the EXE. (No batch). Shortcut not flagged to run as administrator, EXE is flagged: EXE not running.
e) Startup shortcut to the EXE. (No batch). Shortcut not flagged to run as administrator, EXE not flagged: EXE is running but not as administrator.
I tried disabling the UAC completely - same results. I also tried to have another EXE instead of the batch, with the same results.
So - is there a way to have a shortcut to an EXE from startup which will run an EXE as administrator?
You can do it with help of the Task Scheduler.
Open Run dialog Win + R
and run following command:
%SystemRoot%\system32\taskschd.msc
Hit Create Task...
Run with highest privileges
Actions
tab, New....
, browse to your prog.exe
Go to your .bat file and at the place where you want to run your prog.exe add
schtasks /run /tn "FooBar"
Bat file doesn't have to run as administrator (if it doesn't need to), prog.exe will start elevated without any prompts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With