Re: How To Execute Batch File Line By Line

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Thanks for your response Wes.
I tried it out but did not get the results I wanted. I should have mentioned
that I wanted to execute each line in the batch file one at a time with a
pause between each line.
The Command /y/c achieved this and asked me if I wanted to continue after a
line was executed.

Rita

"Wesley Vogel" wrote:

CMD /C will do it without the /y switch.

COMMAND /C string Carries out the command specified by string, and then
stops.

CMD /C Carries out the command specified by string and then terminates.

See...
Using CMD in a batch script
here...
CMD.exe
http://www.ss64.com/nt/cmd.html

See also...
http://techrepublic.com.com/5208-6230-0.html?forumID=89&threadID=169638&messageID=2079857

Note: .cmd files will NOT work on non Windows NT versions i.e. Windows 9x,
Me,
etc. where .bat files will.

Both .cmd and .bat files work on Windows NT versions.

Windows XP is really Windows NT 5.1.

..CMD will be listed in PATHEXT under the Set command in NT in a command
prompt and will NOT be listed under non NT i.e. Windows 9x, Me, etc.

The environmental variable PATHEXT shows a list of file extensions that are
considered to be executable and regulates which extensions do not need to be
typed in a Command Prompt or the Run command.

---------------------------
Report Class Name
---------------------------
File Extension .cmd
File Class cmdfile
File Description Windows NT Command Script

Files of .cmd will be listed in the File Types dialog box as Windows NT
Command Script.
---------------------------

Report Class Name
---------------------------
File Extension .bat
File Class batfile
File Description MS-DOS Batch File

Files of .bat will be listed in the File Types dialog box as MS-DOS Batch
File.
---------------------------

There is a difference in NT on how .cmd and .bat files are handled.

<quote>
The differences between .CMD and .BAT as far as CMD.EXE is concerned are:

With extensions enabled, PATH/APPEND/PROMPT/SET/ASSOC in .CMD
files will set ERRORLEVEL regardless of error. .BAT sets ERRORLEVEL
only on errors.

Mark Zbikowski \(MSFT\)
<quote>
from...
http://groups.google.com/group/microsoft.public.win2000.cmdprompt.admin/msg/ad9066638815812c


--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In news:73156CCE-D592-4A2B-AD50-6EBE2974EC2A@xxxxxxxxxxxxx,
RitaG <RitaG@xxxxxxxxxxxxxxxxxxxxxxxxx> hunted and pecked:
Hello.

In Windows 98 I could execute a batch file with "Command /y /c batchfile".
This would execute the batch file line by line.

I'm now running Windows XP and this does not work.
Is there another command I can run that will allow me to step through the
lines in a batch file?

Thanks.

Rita


.



Relevant Pages

  • Re: What is the difference between CMD and BAT file ?
    ... ..CMD will be listed in PATHEXT under Set in NT in a command prompt and will ... NOT be listed under non NT i.e. Windows 9x, Me, etc. ... Files of .bat will be listed in the File Types dialog box as MS-DOS Batch ...
    (microsoft.public.windowsxp.general)
  • Re: Great SWT Program
    ... Windows' default command line buffer is explained in detail here: ... For the purposes of a batch file, ... then put the files from the working directory back. ...
    (comp.lang.java.programmer)
  • Re: How To Execute Batch File Line By Line
    ... COMMAND /C string Carries out the command specified by string, ... CMD /C Carries out the command specified by string and then terminates. ... .cmd files will NOT work on non Windows NT versions i.e. Windows 9x, ... Both .cmd and .bat files work on Windows NT versions. ...
    (microsoft.public.windowsxp.general)
  • Re: Subst question
    ... > In a batch file, the @ symbol at the beginning of a line will hide the ... which you can see at a command prompt when you type ... > also limit it to one easily if you type in: echo %OS% ... is this say if the OS is NOT Windows NTgo to logoff or IS Windows ...
    (microsoft.public.scripting.vbscript)
  • Re: Environment Variables...
    ... Open a command prompt, type set /? ... MS-MVP Windows Shell/User ... > So, from a command prompt, within a batch file, how could I accomplish ...
    (microsoft.public.windowsxp.general)