

You maintain control of what the user sees at all times. When you call the function you display data before and after the call. I can either call that function within another function or just in the batch file body. Add a pause in the batch file somewhere before the actual copy part so when the scheduler kicks it off, the pause will give you press any key to continue - hit ctrl-C to terminate the batch. If rake is another batch file, command interpreter. I frequently do this by defining the work to be done in a batch function. Default interpreters from Microsoft are done in a way, that causes them exit when they reach EOF.

1 Display variable 1Īfter they've made their input you clear the screen and then re-display all the info you want them to see.

For example here's some psuedocode where you're showing the user 4 variables and waiting for the user to enter something into your menu to affect one of the variables. If you're going to display info on the screen beyond just quick and dirty troubleshooting info, make sure you're cognizant of screen refreshes. Precede the line to be commented by a ::(double colon).ITSX got it right. Comments are also required to write some information about a command such as why it is written, what it will do etc.Ĭomments in a batch file can be written in two ways: This will open up the batch file in notepad where it can be easily modified.Ĭomments are the lines or commands which will not be executed. Right click the batch file and Select Edit option. For changing the contents of a batch file, open it just like any other text file, change the contents and save. With this approach you must use pause command at the end otherwise the window will automatically disappear after the execution completes.Ī simple problem with this approach is that if there is any error in batch file execution, then you may not be able to see it since the batch file might close in case of an error.įurther, after execution, this window will disappear on the press of any key where as in first method, the execution window remains there.Ī batch file once created can also be modified.
