관리자 권한으로 TEMP 폴더 내용 삭제 BAT
페이지 정보
본문
[code]
REM --add the following to the top of your bat file--
@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"
    set params = %*:"=""
    echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
    "%temp%\getadmin.vbs"
    del "%temp%\getadmin.vbs"
    exit /B
:gotAdmin
    pushd "%CD%"
    CD /D "%~dp0" 
REM del /f/s/q "C:\WINDOWS\Temp\*.*"
REM    del /f/s/q "C:\Temp\*.*" > nul
del /f/s/q "C:\log\*.*"
del /f/s/q "C:\Users\xxx\AppData\Local\Microsoft\Windows\INetCache\*.*"
forfiles /P "C:\WINDOWS\Temp" /S /M *.* /D -1 /C "cmd /C del /f/s/q @path"
forfiles /P "C:\Temp" /S /M *.* /D -1 /C "cmd /C del /f/s/q @path"
[/code]
댓글목록
등록된 댓글이 없습니다.
 
            