Net session >nul 2>nul&if not errorlevel 1 goto Administrator_OK If defined Localy FOR %%I IN ("%~1") DO SET "PATH_BAT=%%~dI%%~pI" :: if earlier variable "ShowAdminInfo" is empty (not defined) then no info, else showing info with number of seconds :: Also keep Batch directory localisation and then set variable: PATH_BAT Paste this on top: net session >nul 2>nul&if errorlevel 1 Batch_Admin "%~0" %* :: A D M I N I S T R A T O R - Automatically get admin rights for script batch. See info inside.&TIMEOUT /T 30>nul&goto:eof) If "%~1"="" (echo *** Batch_Admin ***&echo.&echo Automatically get admin rights for another Batch. Extended information about this is on my site.Ĭopy the following text into Notepad and save it to disk as: Batch_Admin.bat off Just the script will be executed again.īelow a complete script Batch_Admin. The transition to Administrator rights always requires that you run the script completely again, in a new window, in a new environment, without recourse to the the variables are set previously in our script and values of these variables did not pass then to call as Administrator.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |