Command Line

 


Use keywords to find the content you
are looking for with in the site.

Batch Programs

A batch program is a simple text file that contains a sequence of programs or commands to run. In order to distinguish a batch program from a ordinary text file, batch programs have a file name extension of either .BAT, .CMD or .WBT. Any text editor (eg. NOTEPAD.EXE ) can be used to create and write a batch program.

Batch programs can be run from the WinOne® prompt, in which case the batch program will be displayed inside the main WinOne® window, unless the CALL command is used to run the batch program, then the batch program will be displayed in a separate window or if an appropriate PIF file exists then it may be run full screen. For more information on PIF files see the help file for the program PIFEDIT. Additionally, .BAT and .CMD batch programs can be started from Explorers' Context Menu's, by right clicking on the icon (to display the Context Menu) and Selecting Run with WinOne. .WBT batch programs are a special case and can be run from Explorer by simply doubling clicking on the icon for the batch program. When a .WBT batch program is started in this way, the main WinOne® window is not displayed, instead a small icon appears in the System Tray. .WBT batch programs should be used for batch programs that include Dialog Box's as Dialog Box's do not require the mai

When a batch program is run so that it is displayed in the main WinOne® window, then the complete batch program is loaded into memory before the execution of the commands in the batch program starts. This greatly improves the performance and speed of batch programs.

There are a number of batch commands that can be used in a batch program to enhance the capabilities of batch programs. The batch commands, listed below, are separated into three categories, standard, enhanced and dialog batch commands. Standard batch commands are compatible with CMD.EXE. Enhanced and Dialog batch commands are native to WinOne® and therefore they are not supported by CMD.EXE. Typically, when a batch program is destined to run under different command shells then the enhanced and dialog batch commands should not be used. When this requirement is not necessary then the use of enhanced and dialog batch commands will greatly improve the functionality and usefulness of batch programs.

Standard Batch Command

CALL Run a second batch program, then returns to the first batch program.
ECHO Display a message or turns echo on or off.
ENDLOCAL End the localisation of environment variables.
FOR Perform a command for each file in the specified set of files or perform a command a given number of times.
GOTO Switch to another part of the batch program, and continue executing the program from that point.
IF Perform conditional processing in a batch program.
PAUSE Suspend processing of a batch program and displays a message.
REM Allows comments inside a batch file.
SETLOCAL Set the localisation of environment variables.
SHIFT Change the position of replaceable parameters in a batch program.

Enhanced Batch Commands

ASK Ask a yes/no question and set the errorlevel respectively.
BEEP Send a beep to the system speaker or turn the system sound on or off.
BOX Display a box in one of four pre-defined formats.
CALC Perform basic arithmetic calculations in a batch program.
CALLPROC Call a procedure with in a Batch program.
COLOUR Sets foreground and background colours inside a batch program.
COMMA Insert comma's into a number.
DATA Clear or add items to a global list.
DATE2SER Convert a date to a serial date value.
DIRS Display the directory stack.
DISKFREE Get the amount of free disk space for the specified drive.
DISKUSED Get the amount of used disk space for the specified drive.
END End a batch program.
ENUMREG Enumerate all the keys in the System Registry for the specified hkey.
FILEDATE Get the last modified date of a file.
FILESIZE Get the size (in bytes) of a file.
FILETIME Get the last modified time of a file.
FILETYPE Determine whether a file contains text or binary data.
GETINI Get an initialisation file key value or enumerate all the key names in a section.
GETKEY Wait for a single keypress from the user.
GETNUM Wait for a sequence of keypresses from the user.
GETREG Get a System Registry value or enumerate all the names for the specified hkey.
GETSTR Wait for a sequence of keypresses from the user.
GOSUB Jump to another part of a batch program and continue executing the batch program from that point onwards until a RETURN command is found. Execution of the batch program will then return to the next command following the original GOSUB command.
LOCATE Position the cursor anywhere on the screen.
LOWER Convert a text string to lower case.
PARSE Allows a sentence to be broken into pieces.
PLAY Play a wave sound (ie. .WAV) file.
POPD Pop a directory from the directory stack and make this directory the current directory.
PUSHD Push the current directory onto the directory stack and change to the specified directory.
READ Read the next item from the global list.
READLN Read a line of text from a file.
RETURN Return to the next command following the original GOSUB command.
SAY Display a message. This command with NOT add a carriage return - line feed at the end of the message.
SEED Randomise the random number generator or set the seed to the specified value.
SER2DATE Convert a serial date value to a date.
SETINI Set or delete an initialisation file key value.
SETREG Set or delete a value for the specified hkey in the System Registry.
SLEEP Do nothing for some time.
STOP Stop processing a batch program and continue processing the batch program that called this batch program (ie. via the CALL batch command).
STRFIND Find the first occurrence of a string within the specified text.
STRPAD Pad a text string with space characters.
STRREP Replace all occurrences of a string within the specified text with another string.
STRREV Reverse all the characters in a text string.
STRRFIND Find the last occurrence of a string within the specified text.
STRSIZE Determine the length of a string.
STRSPLIT Split a string at the specified position.
STRTRIM Remove leading and trailing space characters from a text string.
SUBSTR Extract a section of text from a text string.
UPPER Convert a text string to upper case.

Dialog Batch Commands

CBADD Add a string to the list box of a combo box or return the number of strings contained in the list box of a combo box.
CBDELETE Delete a string from the specified location in the list box of a combo box or clear the contents of a combo box.
CBDIR Add a list of file names to the list box of a combo box.
CBFIND Search the list box of a combo box for a string beginning with the characters in the specified string.
CBGET Get the index of the currently selected string, if any, in the list box of a combo box.
CBINSERT Get the index of the currently selected string, if any, in the list box of a combo box.
CBSET Set the current selection for the list box of a combo box.
CBTEXT Get the string at the specified index from the list box of a combo box.
CHECK Set the state of a check box.
DLGBOX Create a dialog box.
DLGEND End a dialog box and return control to the respective DLGSHOW command.
DLGENDALL End all dialog box's.
DLGITEM Add an item to a dialog box.
DLGMENU Add an item to a dialog box's menu bar.
DLGSHOW Display a dialog box and wait for the dialog box to end.
ENABLE Enable or disable an item in a dialog box.
GETFOCUS Retrieve the identifier of the dialog item that has the keyboard input focus.
GETTEXT Retrieve the caption of a dialog box or the text of a dialog box item.
GREY Grey or ungrey a menu item in a dialog box.
ISCHECKED Determine the state of a check box or a radio button.
ISENABLED Determine whether an item is enabled or disabled.
ISGREYED Determine whether or not a menu item is greyed.
ISTICKED Determine whether or not a menu item is ticked.
LBADD Add a string to a list box or return the number of strings contained in a list box.
LBDELETE Delete a string from the specified location in a list box or clear the contents of a list box.
LBDIR Add a list of file names to a list box.
LBFIND Search a list box for a string beginning with the characters in the specified string.
LBGET Get the index of the currently selected string, if any, in a list box.
LBINSERT Insert a string at a specified locating in a list box.
LBSET Set the current selection for a list box.
LBTEXT Get the string at the specified index from a list box.
RADIO Set the state of a group of radio buttons.
SETFOCUS Set the keyboard input focus to the specified dialog box or item.
SETTEXT Set the caption of a dialog box or the text for a dialog box item.
TICK Tick or untick a menu item in a dialog box.

Copyright © 1995-2018 Lucien Cinc, All Rights Reserved
WinOne® is an Australian registered trademark

Go to the Australian Command Line Software web site.