如何使用Windows批处理脚本从文本文件中删除内容 [英] How to delete content from a text file using windows batch script

查看:677
本文介绍了如何使用Windows批处理脚本从文本文件中删除内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个demo.txt文件.我需要使用批处理文件删除该文件中的内容.请告诉我删除demo.txt文件内容的命令.

I have a demo.txt file. I need to delete content in that file using a batch file. Please tell me the command to delete content for demo.txt file.

推荐答案

break>demo.txt

尝试一下.它将在demo.txt的位置设置一个空文件.由于break是不执行任何操作的内部命令,因此它应该非常快.break命令只能使用/?参数生成输出,因此使此方法非常可靠.

Try this.it will set an empty file on the place of demo.txt. As break is internal command that does nothing it should be pretty fast.Also the break command can produce output only with /? argument so this makes this method pretty robust.

这篇关于如何使用Windows批处理脚本从文本文件中删除内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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