如何创建将按计划删除文件夹的批处理脚本?

时间:2021-02-03 15:29:49

Exact Duplicates:

How do I create a batch script that will delete a folder on a scheduled basis?

如何创建将按计划删除文件夹的批处理脚本?

4 个解决方案

#1


Write a batch script to delete the file

编写批处理脚本以删除该文件

rd <YOURDIR>

and then schedule it in Windows Tasks.

然后在Windows任务中安排它。

#2


Create a batch to delete the file and then place it on a scheduled task on a server or workstation.

创建批处理以删除文件,然后将其放在服务器或工作站上的计划任务中。

#3


You write your batch file and then, even better than using the Scheduler manually, you can use the at command to schedule the .bat file to run periodically.

您编写批处理文件,然后,甚至比手动使用调度程序更好,您可以使用at命令安排.bat文件定期运行。

The advantage of this is that you can put your final at command in a second bat file for easier distribution to your target systems.

这样做的好处是,您可以将最终命令放在第二个bat文件中,以便更容易地分发到目标系统。

at reference page on help.microsoft.com

在help.microsoft.com上的参考页面上

#4


In a text editor do the following

在文本编辑器中执行以下操作

@echo off
rd <enter your directory name here>

Save the file as filename.bat

将文件另存为filename.bat

Create a scheduled task and select the batch file as the file to run.

创建计划任务并选择批处理文件作为要运行的文件。

#1


Write a batch script to delete the file

编写批处理脚本以删除该文件

rd <YOURDIR>

and then schedule it in Windows Tasks.

然后在Windows任务中安排它。

#2


Create a batch to delete the file and then place it on a scheduled task on a server or workstation.

创建批处理以删除文件,然后将其放在服务器或工作站上的计划任务中。

#3


You write your batch file and then, even better than using the Scheduler manually, you can use the at command to schedule the .bat file to run periodically.

您编写批处理文件,然后,甚至比手动使用调度程序更好,您可以使用at命令安排.bat文件定期运行。

The advantage of this is that you can put your final at command in a second bat file for easier distribution to your target systems.

这样做的好处是,您可以将最终命令放在第二个bat文件中,以便更容易地分发到目标系统。

at reference page on help.microsoft.com

在help.microsoft.com上的参考页面上

#4


In a text editor do the following

在文本编辑器中执行以下操作

@echo off
rd <enter your directory name here>

Save the file as filename.bat

将文件另存为filename.bat

Create a scheduled task and select the batch file as the file to run.

创建计划任务并选择批处理文件作为要运行的文件。