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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/615008/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 12:07:01  来源:igfitidea点击:

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

windowsscripting

回答by Andrew Hare

Write a batch script to delete the file

编写一个批处理脚本来删除文件

rd <YOURDIR>

and then schedule it in Windows Tasks.

然后在 Windows 任务中安排它。

回答by Ishmael

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

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

回答by Eppz

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.

创建定时任务,选择批处理文件作为运行文件。

回答by Tiberiu Ana

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

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

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

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

atreference page on help.microsoft.com

help.microsoft.com上的参考页面