Компьютерный форум OSzone.net  

Компьютерный форум OSzone.net (http://forum.oszone.net/index.php)
-   Скриптовые языки администрирования Windows (http://forum.oszone.net/forumdisplay.php?f=102)
-   -   [решено] Очистка и удаление папок (http://forum.oszone.net/showthread.php?t=294662)

rosalin 29-01-2015 13:28 2463186

Очистка и удаление папок
 
Ребята помогите поправить

Код:

SetLocal EnableExtensions

For /F "Tokens=2*" %%I In ('Reg Query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /V ProfilesDirectory') Do Set Profiles=%%J
Call Set Profiles=%Profiles%

For /F "Delims=" %%I In ('Dir /B /AD-S-H "%Profiles%" ^| FindStr /V /B /I /C:"All Users"') Do (
Del /F /S /Q /a "%Systemdrive%\Temp\*.*"
Del /F /S /Q /a "%Profiles%\%%I\Local Settings\Temp\*.*"
Del /F /S /Q /a "%Profiles%\%%I\Local Settings\Temporary Internet Files\*.*"

call rd /s /q "%Profiles%\%%I\Local settings\Application data\1C\1Cv82\????????-????-????-????-????????????"
call md "%Profiles%\%%I\Local settings\Application data\1C\1Cv82\????????-????-????-????-????????????"

не получаться удалять папки по маске ????????-????-????-????-????????????, набор букв и цифр, например такой 40f9cf68-a6b1-421c-9d7d-39976cada901 у всех пользователей разный через дефис, нужно удалить папку и что в папке

Georgio 30-01-2015 04:52 2463560

Код:

@echo off& setLocal enableextensions

for /f "tokens=2*" %%I in ('
 reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /v ProfilesDirectory^| findstr /i ProfilesDirectory
') do (
 call pushd "%%J"
 for /f "delims=" %%K in ('dir /ad-h-s/b^| findstr /ivxc:"All Users"') do (
  pushd "%%K\Local Settings"
  del /a/f/s/q "Temp"
  del /a/f/s/q "Temporary Internet Files"
  pushd "Application data\1C\1Cv82"
  for /f "delims=" %%L in ('
  dir /ad/b "????????-????-????-????-????????????"^| findstr /rc:"^........-....-....-....-............$"
  ') do (
  rd /s/q "%%L"
  )
  popd& popd
  )
 popd
 )

del /a/f/s/q "%Systemdrive%\Temp"

endlocal& exit /b 0


Код в работе не проверял!


Время: 23:03.

Время: 23:03.
© OSzone.net 2001-