Advertisement
Najeebsk

ADMINISTRATOR.bat

Dec 10th, 2024
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.28 KB | None | 0 0
  1. @echo off
  2. :: Check for admin privileges
  3. net session >nul 2>&1
  4. if %errorlevel% neq 0 (
  5.     echo Requesting administrator privileges...
  6.     powershell -Command "Start-Process '%~f0' -Verb RunAs"
  7.     exit /b
  8. )
  9.  
  10. :: Your main script starts here
  11. echo Running as administrator!
  12. pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement