Batch files: Difference between revisions
No edit summary |
mNo edit summary |
||
Line 3: | Line 3: | ||
The OS/2 system natively runs OS/2 batch files that have the the file extension '''CMD''' and if you have the [[DOS]] subsystem installed the system also runs any DOS batch file, which in turn have the extension '''BAT'''. If you do not have the DOS subsystem installed on your system you can also run DOS batch files from an emulator such as [[DOSBox]], but you will lose all the nifty integration features that the OS/2 DOS subsystem has to offer. DOS and OS/2 batch files are for the most part identical except for the fact that the CMD files run inside an OS/2 Command shell and the BAT files inside a DOS Command shell, and if you have the DOS subsystem installed you can call OS/2 programs from DOS batch files and DOS programs from OS/2 batch files. | The OS/2 system natively runs OS/2 batch files that have the the file extension '''CMD''' and if you have the [[DOS]] subsystem installed the system also runs any DOS batch file, which in turn have the extension '''BAT'''. If you do not have the DOS subsystem installed on your system you can also run DOS batch files from an emulator such as [[DOSBox]], but you will lose all the nifty integration features that the OS/2 DOS subsystem has to offer. DOS and OS/2 batch files are for the most part identical except for the fact that the CMD files run inside an OS/2 Command shell and the BAT files inside a DOS Command shell, and if you have the DOS subsystem installed you can call OS/2 programs from DOS batch files and DOS programs from OS/2 batch files. | ||
In addition you can install a number of alternate command line interfaces that either allow you to expand the number of available batch file commands or run completely different types of batch files. Most third party command shells have some sort of batch file functionality built in and some have full scripting languages, the [[4OS2]] and [[4DOS]] replacement shells have an batch language very similar to the OS/2-DOS language but with extensions, the 4OS2/DOS batch files use the '''BTM''' file extension. Command line shells ported from the [[UNIX]] world will allows you to run classic '''sh''' [[ | In addition you can install a number of alternate command line interfaces that either allow you to expand the number of available batch file commands or run completely different types of batch files. Most third party command shells have some sort of batch file functionality built in and some have full scripting languages, the [[4OS2]] and [[4DOS]] replacement shells have an batch language very similar to the OS/2-DOS language but with extensions, the 4OS2/DOS batch files use the '''BTM''' file extension. Command line shells ported from the [[UNIX]] world will allows you to run classic '''sh''' [[shell scripts]], which are more feature rich than OS/2 style batch files but not quite as powerful as [[REXX]] scripts. | ||
While the DOS market saw a huge number of utility programs released that allowed you to extend the functionality of batch files there was never such a market for batch extenders for OS/2 although a few popped up. This is mainly due to the presence of [[REXX]] as a component of the OS, but since that is a fully fledged programing language, albeit one that is unusually easy to use, you can in most cases literally create the functions you might want from REXX in less time than it would take you to trace down a third party utility on the net. | While the DOS market saw a huge number of utility programs released that allowed you to extend the functionality of batch files there was never such a market for batch extenders for OS/2 although a few popped up. This is mainly due to the presence of [[REXX]] as a component of the OS, but since that is a fully fledged programing language, albeit one that is unusually easy to use, you can in most cases literally create the functions you might want from REXX in less time than it would take you to trace down a third party utility on the net. |
Revision as of 06:54, 16 January 2016
Batch files are text files that are used to execute system commands in sequence. Those include all commands you can use from a command line window, any external program that is in the path or that you specifically point to in a location outside of the path, in addition to small number of commands that are either specific to batch files and do not function inside the command line shell or commands that will function but are not meaningful in normal command line usage.
The OS/2 system natively runs OS/2 batch files that have the the file extension CMD and if you have the DOS subsystem installed the system also runs any DOS batch file, which in turn have the extension BAT. If you do not have the DOS subsystem installed on your system you can also run DOS batch files from an emulator such as DOSBox, but you will lose all the nifty integration features that the OS/2 DOS subsystem has to offer. DOS and OS/2 batch files are for the most part identical except for the fact that the CMD files run inside an OS/2 Command shell and the BAT files inside a DOS Command shell, and if you have the DOS subsystem installed you can call OS/2 programs from DOS batch files and DOS programs from OS/2 batch files.
In addition you can install a number of alternate command line interfaces that either allow you to expand the number of available batch file commands or run completely different types of batch files. Most third party command shells have some sort of batch file functionality built in and some have full scripting languages, the 4OS2 and 4DOS replacement shells have an batch language very similar to the OS/2-DOS language but with extensions, the 4OS2/DOS batch files use the BTM file extension. Command line shells ported from the UNIX world will allows you to run classic sh shell scripts, which are more feature rich than OS/2 style batch files but not quite as powerful as REXX scripts.
While the DOS market saw a huge number of utility programs released that allowed you to extend the functionality of batch files there was never such a market for batch extenders for OS/2 although a few popped up. This is mainly due to the presence of REXX as a component of the OS, but since that is a fully fledged programing language, albeit one that is unusually easy to use, you can in most cases literally create the functions you might want from REXX in less time than it would take you to trace down a third party utility on the net.
OS/2 Batch file commands
- CALL
- ECHO
- ENDLOCAL
- EXTPROC
- FOR
- GOTO
- IF
- PAUSE
- REM
- SETLOCAL
- SHIFT
In addition the above commands a batch script can call any valid OS/2 program including normal executables, scripts in other languages and system commands. Most batch commands have formatting and options more like a executable than what you would expect from a scripting language. Some batch file commands can also be used from the command line but have limited utility there.
OS/2 text & programmers editors with OS/2 batch file support
- Boxer - Support built in
DOS text & programmers editors with OS/2 batch file support
- Boxer - Support built in
DOS Batch file commands
- @
- %?
- %?%
- CALL
- ECHO
- FOR
- GOTO
- IF
- PAUSE
- REM
- SET
- SHIFT
OS/2 text & programmers editors with DOS batch file support
- Boxer - Support built in
DOS text & programmers editors with DOS batch file support
- Boxer - Support built in
Links
- Roger Orr: Extending OS/2 Batch Files - Uses very simple REXX files as an example
- JaTomes OS/2 Batch file commands - Fairly exhaustive
- Rob van der Woude's Scripting site - Has lots of info