I have a below batch file as conf.bat
Rem Batch file starts
ipconfig /release
ipconfig /renew
ipconfig /flushdns
ipconfig /registerdns
Rem Batch file ends.
Here, the command prompt display with “The requested operation requires elevation” for (ipconfig/registerdns).
I want to self elevate bat file and to auto select the [ok] button for UAC prompt for this batch file {conf.bat].
Pl. help.
— KSKwin
How to self elevate the bat file with auto select the UAC prompt with [ok] option.
Moderator: DosItHelp
Re: How to self elevate the bat file with auto select the UAC prompt with [ok] option.
Batch doesn't interact with graphical user interfaces. Something like keyboard and mouse emulation is just not foreseen. Besides of that I suspect that the UAC prompt is secured against automation like that.
However, you might be able to work around it like that:
- Create a scheduled task with "Run with highest privileges" checked. No trigger necessary. "Action" is C\Windows\System32\cmd.exe for the program, and /c ""C:\wherever\some.bat"" for the argument.
- Run this task from within a batch script using the SCHTASKS command.
Steffen
However, you might be able to work around it like that:
- Create a scheduled task with "Run with highest privileges" checked. No trigger necessary. "Action" is C\Windows\System32\cmd.exe for the program, and /c ""C:\wherever\some.bat"" for the argument.
- Run this task from within a batch script using the SCHTASKS command.
Steffen