9

Is there any way in Windows batch scripts to get debug information besides adding echo everywhere? I'm looking for bash 'set -x' equivalent on Windows machine.

Just using '-x' in cygwin and running Windows script from there doesn't output this data.

5
  • 2
    Since winbatch and bash are different animals, you should explain what bash set -x does.
    – Magoo
    Commented Nov 7, 2016 at 11:19
  • tldp.org/LDP/Bash-Beginners-Guide/html/sect_02_03.html In general it prints out all commands run in script.
    – pholat
    Commented Nov 7, 2016 at 13:26
  • We don't go chasing links. You need to specify (at least in general) what needs to be done.
    – Magoo
    Commented Nov 7, 2016 at 13:28
  • Please see what I've wrote after the link. Although I don't understand why chasing this link is bad, or against stackoverflow policies.
    – pholat
    Commented Nov 7, 2016 at 15:22
  • All of the information required to solve the problem in one place so that those interested aren't forced to search through comments that may be spirited away by moderators alleging "lengthy discussions" nor referring to links that may become invalid in time (ie. outside of the Stack Exchange network.) In practical terms, the more info you provide, the better people are able to help. If you put up even the tiniest barriers, they'll lose interest and move on to something else.
    – Magoo
    Commented Nov 7, 2016 at 15:40

1 Answer 1

10

Put "@echo on" at the beginning of your script

At-sign at the beginning of the line suppress echo of this first line

2
  • 1
    "@Echo off" was kind of "command > /dev/null' redirection for me. I would need to change multiple batch scripts with this approach. Also will all batch calls with directories and directory changes seen with echo on?
    – pholat
    Commented Nov 7, 2016 at 15:21
  • command > /dev/null equivalent in windows scripting is command>NUL. You should see full paths with @echo on Commented Nov 7, 2016 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.