반응형
@echo off :: BatchGotAdmin :------------------------------------- REM --> Check for permissions >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" REM --> If error flag set, we do not have admin. if '%errorlevel%' NEQ '0' ( echo 관리자 권한을 요청합니다... goto UACPrompt ) else ( goto gotAdmin ) :UACPrompt echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs" "%temp%\getadmin.vbs" exit /B :gotAdmin if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" ) pushd "%CD%" CD /D "%~dp0" :-------------------------------------- :main cls title Printer Spooler Checking... echo Printer Spooler 서비스 상태를 체크합니다. sc query | findstr /i "Spooler" > nul if not "%ERRORLEVEL%" == "1" goto on // 스풀러가 켜져 있으면 goto run // 켜져 있지 않으면 :on title Printer spooler stopping... net stop spooler >> nul echo 프린터 스풀러 서비스를 중지합니다. echo. goto run :run title Spool file deleting... del /f /s /q "C:\Windows\System32\spool\PRINTERS" >> nul echo 잔여 스풀파일을 삭제합니다. echo. title Printer spooler running... net start spooler >> nul echo 프린터 스풀러 서비스를 실행합니다. echo. sc query | findstr /i "Spooler" > nul if not "%ERRORLEVEL%" == "1" goto comp goto error :error title Error echo. echo 프린터 스풀러 서비스를 실행할 수 없습니다. echo. echo 수동으로 활성화 해주시거나 PC 재부팅을 권장합니다. :comp title 작업 완료. echo. echo 작업이 완료 되었습니다. pause |
spool_del.bat
0.00MB