批量删除旧的配置文件 [英] Batch remove old profiles

查看:76
本文介绍了批量删除旧的配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个脚本(没有delprof.exe)来删除1年以上的Windows XP配置文件.我首先使用CCleaner删除Windows和用户配置文件中的所有临时文件.

I need a script (without delprof.exe) to remove windows xp profiles older than 1 year. I use CCleaner first to remove all temp files in windows and the user profile.

start /wait ccleaner.exe /auto

然后我要删除个人资料.但是rmdir根本无法工作.

Then I want to remove profiles. But simply rmdir won't work.

推荐答案

这应该做到:

@echo off & setlocal
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%"
set /a YYYYprev=%YYYY%-1
wmic path win32_userprofile where "not LocalPath like '%Admin%' and special=false and loaded=false and LastUseTime<'%YYYYPrev%%MM%%DD%'" delete

这篇关于批量删除旧的配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆