如何调试.BAT脚本? [英] How can I debug a .BAT script?

查看:427
本文介绍了如何调试.BAT脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法通过一个.bat脚本?事情是,我有一个构建脚本,它调用了很多其他脚本,我想看看它们被调用的顺序是什么,以便我可以知道我必须在哪里,并添加我的修改

解决方案

我不知道如何逐步执行.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆