起因:用户上传了公司文件服务器上的许多可执行文件,有些是盗版破解软件,需要删除,但不可能一个接一个地删除,所以你需要写一个简单的脚本来定期批量执行。
要求:删除用户上传的所有内容exe文件(当然也可以定义删除其他文件)。
脚本:内容很简单
@echo off & color 0dcls & echo start delete exe...please wait... for %%a in (d e f g ) do ( cd /d %%a:\\ for /r %%b in (*.exe) do ( del /s /q %%b ))#pauseecho finished...exit
解释:将D盘、E盘、F盘、G盘里面含有exe所有所有文件。

cmdshell
检查程序的可用性:将程序放在C盘下,删除D盘,E盘、F盘、G测试成功后,将计划任务添加到磁盘文件中Linux Crontab 同样,添加步骤如下:
1,打开计划任务-创建基本任务

taskschd.msc
2.增加日常执行计划。

每天
3.计划在夜间23:00执行脚本触发器。

每天
3.计划在夜间23:00执行脚本触发器。

23:00执行
四、任务执行操作。

操作
5.选择脚本存储路径。

脚本存储路径
6.最后完成。
完成最后,你只需要每天检查执行情况,不要太在意。