Solved

Stepping through a dos batch script in windows 7

Posted on 2014-12-09
8
1,853 Views
Last Modified: 2014-12-14
I know I could manually type pause after every line, but is there an easier way to step through a batch file to see what happens after each line?
0
Comment
8 Comments
 
LVL 68

Assisted Solution

by:Qlemo
Qlemo earned 167 total points
ID: 40489312
Sadly no. There is no debug or step mode in cmd.exe.
0
 

Author Comment

by:BeGentleWithMe-INeedHelp
ID: 40489331
! : (
0
 
LVL 51

Accepted Solution

by:
HainKurt earned 84 total points
ID: 40489372
0
 
LVL 68

Assisted Solution

by:Qlemo
Qlemo earned 167 total points
ID: 40489417
Of course there should be some 3rd party tools able to emulate stepwise execution, but it requires some effort to do so and hence there is probably nothing for free.

Nowadays you should take the leap to switch to PowerShell.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 51

Assisted Solution

by:Bill Prew
Bill Prew earned 83 total points
ID: 40489446
A couple of things you can do in a batch file though, certainly not a debugger, but sometimes can help.

(1) You can remove the ECHO OFF line if there is one (or change it to ECHO ON) and then when you run the BAT you will see each line executed echoed to STDOUT.  This take a little practice to read effectively, but can be helpful since it will show you some of the variables resolved to their actual values at runtime.

(2) If you have an idea of what you want to see and where you can add some ECHO commands after key logic and display helpful data like environment variables, or maybe do a DIR command if you are working with files, etc.

(3) When you run the BAT script, send it's output to a file rather than the console, and then you can browse it with an editor after it finishes, and search, etc.

(4) I have occasionally created a little debug subroutine and CALLed it from several locations along the code path.  Then it can display all useful info about variables, files, flags etc each file with headings.  Reduces the effort to adding displays along the way.

~bp
0
 
LVL 23

Assisted Solution

by:NVIT
NVIT earned 83 total points
ID: 40489485
Maybe Batch Compiler...
- Realtime debugging
- IDE for batch scripts
http://sourceforge.net/projects/batchcompiler/?source=directory
http://batchcompiler.sourceforge.net/
0
 
LVL 43

Assisted Solution

by:Steve Knight
Steve Knight earned 83 total points
ID: 40489850
If the batch file is simple, one line, affair without using ( ) to nest items or goto to move around you could probably get away with one batch to read the other using a for command, execute each of it's lines with a pause command between them?

Steve
0
 

Author Closing Comment

by:BeGentleWithMe-INeedHelp
ID: 40499101
Thanks guys!  Here's another question based on Qlemo's comment.  THANKS!  DUH!  Time to learn something new!

http://www.experts-exchange.com/Programming/Languages/Scripting/Powershell/Q_28580586.html
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup". After a while, you have entered a loop for Auto repair which does not fix anything and you will be in a  panic as all your work w…
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now