Solved

Stepping through a dos batch script in windows 7

Posted on 2014-12-09
8
2,785 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 70

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 56

Accepted Solution

by:
HainKurt earned 84 total points
ID: 40489372
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 70

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
 
LVL 56

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 25

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.
Suggested Courses

635 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