

Within our batch file we can use the command "CD" to change this environment variable. Our template forces this to the location of our script. Value contained in this variable is that of the calling application. The current working directory is provided by a top-level environment variable %CD% a copy is passed to the command prompt. Knowing where you are in the folder hierarchy is extremely important.

This command is generally used for test purposes Note there is no space between echo and the full stopĮ) The command "pause" Halts execution allowing you to read the screen. The special command "echo." outputs a blank line. In folder UniServerZ create a new file named test1.bat with the following content: CommentsĪ) Batch file command off" prevents displaying of command lines.ī) Batch file command "rem " allows you to add comments to document the script.Ĭ) The batch file command pair "pushd %~dp0" and "popd" apart from saving and resorting a callers location forces current working directory to the location of the file containing the command pair.ĭ) Command "echo" outputs the string that follows to the screen. The following template meets this requirement. Ideally each file should be autonomous meaning it can be run by another batch file or application. For portability each batch file must be located in the root folder UniServerZ or a folder below this. Uniform Server is portable and does not change the host environment. Directory comes from the early days of DOS programming. Note: The directory and folder are interchangeable. After reading this section you will be able to understand how some of the included batch scripts work. Reason for writing this section is to provide enough information for writing batch scripts to run the various command line utilities found in Uniform Server.
