批处理文件以删除文件 [英] Batch File to Delete File

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

问题描述

有人可以帮我制作一个批处理文件,删除以库存水平开头的文件,这些文件是存储在C:\ Windows \ Temp文件夹中的.csv文件.

Can someone please help me to make a batch file to delete files beginning with the name Stock Level which are .csv files stored in C:\Windows\Temp folder.

我想先测试一下它,然后再发布它,看看它打算删除什么,以便有人可以显示出我也需要删除什么才能使其生效.

I would like to test it first to see what it proposes to delete before I make it live so if someone can show may what I need to delete to make it live as well.

非常感谢您的帮助.

罗伊

推荐答案

作为批处理文件,

@echo off
setlocal
for %%a in ("c:\windows\temp\stock level*.csv") do echo(del "%%a"

应该通过对设置为与提供的掩码匹配的每个文件名的%%a执行echo("%%a"来生成列表.

should generate your list by executing echo("%%a" for %%a set to each filenme matching the mask supplied.

如果结果正确,只需删除echo(部分以激活del

If the result is correct, simply remove the echo( part to activate the del

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

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