如何调试.BAT脚本? [英] How can I debug a .BAT script?
问题描述
我不知道如何逐步执行.bat文件,但您可以使用 echo
和暂停
以帮助调试。
ECHO
将回显批处理文件中的邮件。如ECHO Hello World将在执行时在屏幕上打印Hello World。但是,如果在批处理文件的开头没有@ECHO OFF,您还可以获得ECHO Hello World和Hello World。最后,如果您只想创建一个空行,请键入ECHO。添加结束时间会创建一个空行。
暂停
提示用户按任意键继续。
资料来源:批处理文件帮助
@ workmad3:answer有更好的技巧,可以使用 echo
命令
另一个有用的资源... DDB:DOS批处理文件提示
Is there a way to step through a .bat script? The thing is, I have a build script , which calls a lot of other scripts, and I would like to see what is the order in which they are called, so that I may know where exactly I have to go about and add my modifications.
I don't know of anyway to step through the execution of a .bat file but you can use echo
and pause
to help with debugging.
ECHO
Will echo a message in the batch file. Such as ECHO Hello World will print Hello World on the screen when executed. However, without @ECHO OFF at the beginning of the batch file you'll also get "ECHO Hello World" and "Hello World." Finally, if you'd just like to create a blank line, type ECHO. adding the period at the end creates an empty line.PAUSE
Prompt the user to press any key to continue.
Source: Batch File Help
@workmad3: answer has more good tips for working with the echo
command.
Another helpful resource... DDB: DOS Batch File Tips
这篇关于如何调试.BAT脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!