batch-file - Windows 批处理——保存文件名列表,不包括列表文件本身

标签 batch-file cmd

使用 Windows cmd.exe

dir /b /od > list.txt

创建一个最后一行是list.txt的文件。如何避免字符串 list.txt 出现在文件 list.txt 中?

最佳答案

dir /b /od |findstr /v /b /e "list.txt" >list.txt

可能有更好的方法,但这很简单。

关于batch-file - Windows 批处理——保存文件名列表,不包括列表文件本身,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52191019/

相关文章:

windows - 用于卸载程序的批处理文件

java - 从 Java 执行批处理文件不能访问完整的 PATH

javascript - 使用 CasperJS 作为可移植安装?

windows - BAT 脚本发送命令给它启动的程序

java - 从控制台运行 Java 应用程序时如何查看完整的异常堆栈跟踪?

windows - 批处理脚本或 PowerShell 脚本从文本文件读取多个值并将其插入变量

file - Windows批处理: Iterate over mulitple files lines at the same time

batch-file - 清除MSMQ队列并从bat文件重置IIS

android - 连接多个设备时如何使用 ADB Shell? "error: more than one device and emulator"失败

c# - 将 ctrl+c 发送到 c# 中的 cmd.exe 进程