Administrative rights for RestoreE2B script


I just wanted to thank you for the hugely useful software package development and also for providing that for free. I haven't been able to give much back to you. I noticed that I might be able to contribute with some code though. The thing is that its quite annoying to start the RestoreE2B script with administrative rights. Usually on broken computer the right click menu might take ages to pop up in Windows Explorer. Here is how I make batch scripts ask administrative rights, use it however you like:
In the beginning I usually add:

set "_FilePath=%~f0"
set "_FileDir=%~dp0"
setlocal EnableExtensions EnableDelayedExpansion

And then in the appropriate location the admin rights prompt trigger:

fltmc >nul 2>&1 || (
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\GetAdmin.vbs"
echo UAC.ShellExecute "!_FilePath!", "", "", "runas", 1 >> "%temp%\GetAdmin.vbs"
del /f /q "%temp%\GetAdmin.vbs" >nul 2>&1

I hope that helps. I feel that I cannot thank you enough for your kindness. So thank you again.

Kind regards,
Codeplayer 04/11/2016

New comment

To Top