Reputation: 21172
Is there a program like Visual Studio that allows you to debug (dos) batch files? What techniques could I use to debug? Martin Brown answered a batch file question with a nice for / each loop. I would love to see the values of the variables as they loop.
for /R A %i IN (*.jpg) DO xcopy %i B /M
Upvotes: 6
Views: 12122
Reputation: 1850
As mentioned by other users you can use Running Steps software. You can download it from here
Upvotes: 0
Reputation: 2328
Well i found one it name is Running Steps. You can read more about it at its Homepage . Anyway it supports breakpoints, step in step over and stuff like that :)
Upvotes: 2
Reputation: 21
Running Steps is like the IDE. You get an '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, into, etc. It even unrolls for loops which I find awesome. Check it out at http://www.steppingsoftware.com. It's helped me a lot.
Upvotes: 2
Reputation: 2118
To print the values of the variables as they loop you could try:
for /l %A in (1,1,10) do (
@echo %A
)
If you want to stop and examine each line as it is executed try:
for /l %A in (1,1,10) do (
@echo %A
pause
)
which will halt 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 pipe all the output to a log file, just don't forget to use %%i instead of %i if you're not typing this at the shell.
Upvotes: 5
Reputation: 6248
you mean besides just doing an echo HERE I AM type of thing? i don't know of any. i just debug my batch files by remming out the actions and adding echo's until i know its working correctly. i also wrote my own one line "outputdebugstring" application that sends anything on its command line to the debugger, but that probably isn't necessary for most batches where you can just watch the screen. inserting "pause"'s can help slow things down too.
best regards don
Upvotes: 2
Reputation: 53101
I use Notepad++ to at least give me colour coding when I'm writing/modifying.
Upvotes: 1
Reputation: 62538
Like VS ? Not that I know of.
As far as variable values go, you can always print them out.
Upvotes: 1