在FOR循环中执行.bat文件
编辑:简要摘要
我的目录中有多个文件,称为 crash0、crash1 等。我想使用命令行为每个文件运行一个 .bat
文件,例如:
abc.bat crash0 > crash0.txt
How can I make another.bat 文件为每个文件调用一次
abc.bat
?
原始问题
请在下面找到我的情况。
我的文件夹中有一些文件(每次数量可能有所不同),其名称以 crash 开头。即 crash0、crash1 等。我想将这些文件作为 .bat 文件的输入提供(假设为 abc.bat),然后导航输出相应的文本文件。该命令看起来像 abc.bat crash0 >崩溃0.txt。我必须对文件夹中的所有崩溃文件执行此操作。这个 abc.bat 文件实际上将不可读的文件转换为可读的格式。所以最后我应该有 txt 文件,如 crash0.txt、crash1.txt 等,作为我作为输入提供的相应崩溃文件。任何人都可以帮助使用 .bat 脚本在 cmd 中运行它吗?我是 .bat 脚本编写的新手..提前谢谢
Edit: Brief Summary
I have number files in a directory, called crash0, crash1 etc. I want to run a .bat
file for each of this with a command line like:
abc.bat crash0 > crash0.txt
How can I make another .bat
file that loops over all the crashXX files calls abc.bat
once for each one of them?
Original Question
Please find my situation below..
I have some files (number may vary each time) in a folder with its name starting with crash. That is crash0, crash1..etc. I want to provide these files as an input to a .bat file (let it be abc.bat) and then navigate the out put a corresponding text file. The command looks like abc.bat crash0 > crash0.txt. I have to do this to all the crash files in the folder. This abc.bat files actually converts the non-readable files to a readable format. So at the end I should have txt files like crash0.txt, crash1.txt.. etc for the corresponding crash files which i provided as the input. Can any one help with a .bat script to run this in cmd?? am new to .bat scripting.. thx in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
for %%i in (crash*) do @call abc.bat %%i > > %%i.txt
for %%i in (crash*) do @call abc.bat %%i > %%i.txt