我有一百个文本文件,我想在每个文件的末尾插入数字 1 到 100。下面的脚本会将“此处的一些文本”添加到保存和执行 bat 脚本的目录中的每个文件。
FOR %%i IN (*.txt) DO echo some text here>> %%i
现在,我想将数字 1-100 插入到上述 100 个文本文件中,而不是“这里有一些文本”。
实现此目的的正确脚本是什么?
最佳答案
如果您查看 for/?
FOR /L %variable IN (start,step,end) DO command [command-parameters]
The set is a sequence of numbers from start to end, by step amount. So (1,1,5) would generate the sequence 1 2 3 4 5 and (5,-1,1) would generate the sequence (5 4 3 2 1)
关于windows - 需要有关 Windows 批处理脚本的帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5467447/