Novell is now a part of Micro Focus

Do you know of a program that lets you selectively go through the lines of a batch file?

Articles and Tips: qna

01 Aug 1996


Q.

Dear Ab-end: I know this doesn't have much to do with networking, but do you know of a program that lets you selectively go through the lines of a batch file and execute only those lines you want to run, ignoring the lines you don't want to run?

--Still Batchin' After All These Years

A.

Dear Batchin': If you're up-to-date with DOS, you're in luck. MS-DOS 6.x (and probably other versions, too) allows you to execute lines in a batch file without having to run all of the commands that are stored in the file. Suppose you only wanted to run portions of a file named LOADALL.BAT file on your local hard disk. All you have to do go to drive C and type the following:

COMMAND /Y /C LOADALL.BAT <Enter>

The COMMAND portion spawns a command process to run the designated batch file. The /Y switch steps you through each line of the batch file. For each line, you will be prompted with a [Enter=Y, Esc=N]? prompt. Pressing the Enter key executes the batch file line and takes you to the next line. Ppressing Escape ignores the line and takes you to the next line. This continues until you have gone through every line in the file. The /C switch spawns a command process again when needed (this must be the last switch placed in the command).

* Originally published in Novell AppNotes


Disclaimer

The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.

© Copyright Micro Focus or one of its affiliates