在工作中,我们每天都会处理需要帮助才能在家登录在线银行的人。有时候我们需要用户删除文件并引导他们这样做,在很多时候可能会很烦人和麻烦,因为用户对计算机缺乏经验而浪费了20分钟。
我们一直在谈论一个解决方案(如果可能的话),我们让用户下载一个我们告诉他们运行的批处理文件,然后可以删除我们所需的文件。我在这里问这个问题,因为我们这里没有人在工作,有批处理文件的经验。
就我个人而言,我不时会玩它,但我无法真正找到适合我们需求的解决方案,当我在网上搜索时,我找不到适合的解决方案。该脚本必须自动找到该文件夹(如果可能)。
提前致谢!
答案 0 :(得分:4)
也许这可以帮助你,我评论它让你明白它在做什么;)
:: Program to remove Folders which fullfill the criterias
:: You won't see the commands in the console
@echo off
:: Go to drive C (i think you'll need application data or similar and this is
:: on c, but if the bat is started in an other partition, it will search the
:: one he starts in
C:
:: Go to the path in which you'll search, if you want C:\ , remove this
CD "C:\yoursearchstartpath"
:: Okay, this is the loop, it gets all folders ( /A -D is for folders)
:: which have delMe in their name and then asks if you want to delete it
:: showing the path to make sure you don't delete sth accidentially
for /f "delims=" %%a IN ('dir /S /B /A -D *delMe*') do RD /S "%%a"
:: That the batch file is not closed automatically but shows that it's finished
set /p id="Finished, press Space to quit " %=%
答案 1 :(得分:2)
查看此链接
http://support.microsoft.com/kb/65994
我创建了一个样本批处理文件A.BAT。它检查C:\ Folder \ F1是否存在,并删除文件夹F1(如果可用)
IF EXIST D:\FOLDER\F1 GOTO A
EXIT
:A
D:
DEL D:\FOLDER\F1\*.*
RMDIR F1
希望有所帮助
答案 2 :(得分:2)
一个简单的:
rd /s "%USERPROFILE%\.oces2"
如果他们遵循某种模式(例如以.oces开头):
@echo off
cd /d "%USERPROFILE%"
for /d %%i in (.oces*) do rd /s "%%i"
pause