Restart Print splooer

 @echo off


:: Check for administrative privileges

net file >nul 2>&1

if '%errorlevel%' == '0' ( goto gotAdmin ) else ( goto getAdmin )


:getAdmin

    echo Requesting administrative privileges...

    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"

    echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"

    "%temp%\getadmin.vbs"

    del "%temp%\getadmin.vbs"

    exit /b


:gotAdmin

    pushd "%cd%"

    cd /d "%~dp0"


:: Your actual commands go here

echo Restarting Print Spooler...

net stop spooler && net start spooler

echo.

echo Process complete!

pause


Post a Comment

0 Comments