Windows batch file debugger?

Is there a program like Visual Studio that allows you to debug (dos) batch files? What methods can I use for debugging? Martin Brown answered the question of a batch file with a nice one for each cycle. I would really like to see the values โ€‹โ€‹of the variables as they cycle.

for /RA %i IN (*.jpg) DO xcopy %i B /M

+4
source share
6 answers

To print the values โ€‹โ€‹of variables as they cycle, you can try:

 for /l %A in (1,1,10) do ( @echo %A ) 

If you want to stop and check each line as it runs, try:

 for /l %A in (1,1,10) do ( @echo %A pause ) 

which will stop the script at each iteration.

Your example looks like a backup script for images;

 for /R %i in (*.jpg) do ( @echo %i xcopy %i %DESTINATION% /M ) 

If you make a script of this, you can transfer all the output to a log file, just remember to use %% i instead of% i if you don't type this in the shell.

+5
source

do you mean besides just doing an echo HERE I AM the type of thing? I know nothing. I just debug my batch files, restoring actions and adding an echo until I find out that it works correctly. I also wrote my own application, "outputdebugstring", which sends something on my command line to the debugger, but this is probably not necessary for most batches where you can just watch the screen. inserting a โ€œpauseโ€ can also slow down.

Best regards don

+2
source

Well, I found one name: Steps along the way . You can read about it on the home page . In any case, it supports breakpoints, step by step and all that:

+2
source

The execution steps are similar to the IDE. You get "Analyzer", which is the equivalent of a compiler. It shows you errors and warnings in your code. It has an integrated environment that allows you to step over, etc. It even unfolds for loops that I find amazing. Check it out at http://www.steppingsoftware.com . It really helped me.

+2
source

How is VS? Not that I knew.

As for the values โ€‹โ€‹of the variables, you can always print them.

+1
source

I use Notepad ++ to at least give me color coding when I write / change.

+1
source

All Articles