If it will help, you can save yourself from having to right click and choose Run as administrator using the Elevation PowerToys from Microsoft. They include a tool that lets you run any command as administrator on a console or in a batch file by simply prepending elevate
to any command. (Functionality which really should be shipped with Windows.)
To install this functionality, first download the tools, then run the self-extracting executable and extract them to a directory on disk. Navigate to that directory, right click on ElevateCommand.inf
, and select Install from the context menu.
Now, edit your batch file, and prepend elevate
to your shutdown command, so it looks like this:
elevate shutdown -s -t 5
Now, you can just double-click on your batch script and UAC will automatically prompt you for administrative approval/credentials, no right-clicking required. It is not possible to bypass this dialog without disabling User Account Control.