【发布时间】:2015-05-27 22:57:05
【问题描述】:
Remove trailing spaces from a file using Windows batch? 和 How to remove trailing and leading whitespace for user-provided input in a batch file? 似乎是类似的问题,但我无法得到任何答案。
我有一个文本文件,例如 C:\Users\%username%\Desktop\sometext.txt,其中包含一长串数字,其中一些带有尾随空格。如何循环并删除每行末尾的空格?我想批量完成这一切。它将在一个文件中,其中包含一些其他批处理命令。
【问题讨论】:
-
必须是批处理文件吗?你是否将你的“解决方案”部署到很多机器上并且想要最少的依赖?如果不尝试获得更“现代”的东西。我假设您在任何 Windows >= XP 上。对该主机或 windows 脚本主机使用 powershell,它们可以从您现有的批处理中调用。
-
您能否更具体地说明其他答案中的哪些内容不适合您?
标签: batch-file