2012-12-28 5 views
2

터미널 서버의 모든 사용자 프로필에 대해 firefox 캐시 폴더를 삭제하는 배치 파일을 실행하고 싶습니다. ICSweep과 마찬가지로 모든 사용자의 임시 인터넷 파일을 삭제합니다.터미널 서버의 사용자 프로필에 대한 Firefox 캐시를 삭제하는 일괄 파일

Location: C:\users\ *username*\appdata\local\mozilla\firefox\profiles\ *random*.default\cache 

이슈는 다른 사용자 이름 폴더, 그리고 파이어 폭스 \ 프로필 아래에있는 하위 폴더의 이름은 "임의의 문자 .DEFAULT"를 포함하는 모든 사용자에 대해 서로 다른 것입니다.

배치 파일로 처리 할 수 ​​있습니까? 또는 vb 스크립트와 같은 것이 필요합니까? 이 작업을 수행 할 수 있다면, 나는 또한 Google 크롬 캐시

C:\users\ *username*\appdata\local\google\chrome\user data\default\cache 

답변

2

예에 대해이 작업을 수행 할

이 수행 할 수 있습니다. 그냥 간단한 일괄 재귀가 필요합니다. 이 스크립트는 완전히 사용할 준비가되었습니다. 캐시 폴더를 삭제할 준비가되면 명령을 del 명령으로 바꿉니다. 코멘트

에 대한

:: Hide Commands 
@echo off 
setlocal EnableExtensions 

:: Parse the Local AppData sub path 
call :Expand xAppData "%%LocalAppData:%UserProfile%=%%" 

set "xFirefox=\mozilla\firefox\profiles" 
set "xChrome=\google\chrome\user data" 

:: Start at the User directory 
pushd "%UserProfile%\.." 

:: Loop through the Users 
for /D %%D in (*) do if exist "%%~fD%xAppData%" (
    rem Check for Firefox 
    if exist "%%~fD%xAppData%%xFirefox%" (
     pushd "%%~fD%xAppData%%xFirefox%" 

     rem Loop through the Profiles 
     for /D %%P in (*) do (
      if exist "%%~fP\cache" echo "%%~fP\cache" 
     ) 
     popd 
    ) 

    rem Check for Chrome 
    if exist "%%~fD%xAppData%%xChrome%" (
     pushd "%%~fD%xAppData%%xChrome%" 

     rem Loop through the Profiles 
     for /D %%P in (*) do (
      if exist "%%~fP\cache" echo "%%~fP\cache" 
     ) 
     popd 
    ) 
) 
popd 
goto End 


:::::::::::::::::::::::::::::: 
:Expand <Variable> <Value> 
if not "%~1"=="" set "%~1=%~2" 
goto :eof 


:End 
endlocal 
pause 

업데이트는 파이어 폭스 profiles.ini 파일이 위에서 파이어 폭스 섹션에 대한 검사를 대체 사용합니다.

rem Check for Firefox INI 
if exist "%%~fD%xAppData%%xFirefox%\profiles.ini" (
    pushd "%%~fD%xAppData%%xFirefox%\" 

    rem Loop through the Profiles 
    for /f "tokens=1,* delims==" %%L in (profiles.ini) do (
     if /i "%%~L"=="Path" if exist "%%~fM\cache\" echo "%%~fM\cache" 
    ) 
    popd 
) 
+0

당신은'% APPDATA % \ 영업 이익은 언급하기 때문에 모질라 \ 파이어 폭스 \ profiles.ini' ... – anishsane

+0

@anishsane 파이어 폭스 \이 프로필 폴더에'isRelative = 0'을 고려하지 않았다. 그러나 profiles.ini 파일을 사용하는 데 필요한 수정 사항을 추가했습니다. –

+0

훌륭한 작품 ... 도움을 주셔서 감사합니다! – user1934660

관련 문제