<--- Turn the page     (contents page)     Turn the page --->


Batch Files/DOS


Since one of the Features of this issue has to do with Batch files, I think I will write an article on the DOS side of the Column.



Changing the color of DOS.
Are you tired of the plain White on Black screen of DOS? Most people including myself, like it this way. However on occasion, wouldn't you like to change the colors to Red on Black or White on Blue?

DOS includes a small device driver to take over the CON device. It is called ANSI.SYS. If you have Windoze 9x, it should be in C:\WINDOWS\COMMAND, otherwise it should be in C:\DOS.

Add the following line to your CONFIG.SYS: (Please make a back up first)
For Windoze 9x:
  DEVICE = C:\WINDOWS\COMMAND\ANSI.SYS
For DOS (or where ever your ANSI.SYS file resides):
  DEVICE = C:\DOS\ANSI.SYS

To change the screen colors to L. BLUE text on Black Background add the following to your AUTOEXEC.BAT file (Make a backup first):
@echo off
echo ESC[1;34;40m
NOTE: Change the ESC above to ascii char 27. (In EDIT press the CTRL-P combination and then while holding down the ALT key and using the numeric key pad, enter 27.) Make sure the m is lower case.

Now reboot the system.


Here are the different codes you can use:
ESC[?;?;?m 
  
Where the first ? = one of the following:
    Text attributes 
       0    All attributes off 
       1    Bold on/LIGHT colors
       4    Underscore (on monochrome only) 
       5    Blink on 
       7    Reverse video on 
       8    Concealed on 
  
Where the second ? = one of the following:
    Foreground colors 
       30    Black 
       31    Red 
       32    Green 
       33    Yellow 
       34    Blue 
       35    Magenta 
       36    Cyan 
       37    White 
  
Where the third ? = one of the following:
    Background colors 
       40    Black 
       41    Red 
       42    Green 
       43    Yellow 
       44    Blue 
       45    Magenta 
       46    Cyan 
       47    White 


Some DOS Tips:
Do long DIR listings pass along the screen before you can view them? Well you probably know that you can use the /p parameter to tell DIR to do a page at a time. If you do, you probably get tired of typing the extra characters each type you type DIR /P. Well, you can put a single line in your Autoexec.bat file to tell DIR to use the /P parameter each time.
SET DIRCMD=/P
If you do want DIR to wiz by, then just use the /-p parameter.


Are you tired of the new COPY command that asks for an overwrite response? You can put the following line in your Autoexec.bat file and COPY will not ask you any more:
SET COPYCMD=/y
If you do want COPY to ask you on some important copies, then just use the /-y parameter.


How many times have you wanted to put that directory listing in a file? DOS's redirection is the key:
DIR /-p > dirfile.txt
Notice the /-p. If you use the DIR tip noted above, don't use this parameter, and have a long listing, DOS will pause for each page with out printing it to the screen.


Want to add a dir listing to a file rather than creating a new file? Use the same line but add another redirection symbol:
DIR /-p >> dirfile.txt
This will append the file dirfile.txt.

One of your favorite DOS commands doesn't have a /p parameter to print a page at a time? Try the PIPE symbol "|" (shift Backslash) and the MORE command.
mem /c | more


Do you have a DOS tip? Let us know and we could put it here in the next issue. ¥



<--- Turn the page     (contents page)     Turn the page --->

Page 8