home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1995 November
/
PCWK1195.iso
/
inne
/
podstawy
/
dos
/
4dos
/
4uzytki
/
4dtnt.exe
/
AUTOEXEC.ZIP
/
AUTOEXEC.DOC
< prev
Wrap
Text File
|
1991-11-03
|
6KB
|
215 lines
This is an extract of my autoexec.bat file. It shows a number of little
tricks to help manage your configuration and to maintain drive letter
independence. This one is IDENTICAL on my hard disk and my boot diskettes.
In a multi-machine site, this example could be the basis of an autoexec
which is independent of any particular system configuration and is
generically usable on all machines at a given site.
Debugging aids
@echo off
rem pause
Find the boot drive and the "DRIVERS" directory where I keep all my
TSRs. Keeping them in environment variables eliminates a lot of
hard coding later.
set bootd=%[_boot]:
set drp=%bootd%\DRIVERS\
Call a couple of processes which are tad long for in-line code.
The first one figures out the letter of my ramdisk. The second
sets my CDPATH down all my hard drives for drive letter indpendence
later.
gosub setramd
gosub cdpath
Vary the size of my disk cache based on the amount of EMS remaining.
The maximum is 2048K no matter how much EMS is left. If there isn't
at least 512K left, disk caching is not used.
set csize=%@eval[%@ems[k]-512]
if %csize gt 2048 set csize=2048
if %csize gt 512 %drp%loadhi %drp%adcache -w0.2 -e%csize
unset csize
Set buffers, files, and fcbs. Note the use of @name to get the
major part of the DOS version. It works because @name is just
a string parser, not a file manipulator, so "5.0" can be string
which is not necessarily a file name. The @int function could
have been used instead, but @int was added late in the beta
cycle, while _dosver was introduced early.
if %@name[%_dosver] lt 5 %drp%loadhi %drp%buffers +3
%drp%loadhi %drp%files +80
%drp%loadhi %drp%fcbs +20,2
Another call to a piece I'd rather keep separate instead of in-line.
gosub uvsetup
Finish loading the rest of the TSRs:
%drp%loadhi %drp%uvreset
%drp%loadhi %drp%4dos24h
%drp%loadhi c:\dos\mode lpt1,,b
%drp%loadhi %drp%dmp /NV /G+ /MXP /D%ramd%
%drp%loadhi %drp%kstack.com
%drp%loadhi %bootd%\dos\trakball dos
Switch to BTM mode now that all TSRs are loaded.
loadbtm on
Switch to my ramdisk
%ramd%
Copy all the stuff to ramdisk that I want fast repeat access to.
copy %bootd%\ramdisk\*.* %ramd% >& NUL
Extract the path portion of comspec for future use. Again, the
4DOS @path function is just a parser.
set compath=%@path[%comspec%]
Because I've been a beta tester since the 3.0 days, I have some
version dependencies built in to facilitate switching back and
forth between 3.x and 4.x. This stuff shouldn't be necessary
for normal use, but you never know.
iff "%_4ver" ne "" then
Copy 4DOS.COM to the ramdisk for fast shelling and switch COMSPEC.
copy %compath%\copylib\*.* %ramd% >& NUL
set comspec=%ramd%\4DOS.COM
endiff
I've been doing some ANSI clone beta testing, too, so there's a
switch on whether the ANSI driver happens to be loaded this time.
iff %_ansi == 0 then
prompt $P$g
else
prompt $e[37;44m$P$g
endiff
Set a bunch of environment variables for various utilities.
set temp4dos=%ramd%
set temp=%ramd%
set tmp=%ramd%
set pktmp=%ramd%
Here's the first way I tested for version 3.x versus 4.x. The _4ver
variable wasn't available in early beta tests. This one uses the fact
that only 3.x and below have 4DOSn.EXE files.
iff exist %compath%4dos286.exe then
path %ramd%\;%bootd%\dos
else
path %ramd%\;.;%bootd%\dos
endiff
Note (above) the very short PATH; especially the "else" case for 4DOS
4.0 which causes it to look on the ramdisk first for fastest possible
loading of the most commonly used utilities.
if "%_4ver" eq "" set 4dshell=/u /s:b%ramd%\ /e+256u
unalias *
Switching alias loads depending upon the DOS version. I used this
while being noncomittal about my 5.0 upgrade.
iff %@name[%_dosver] ge 5 then
alias /R %compath%aliases.500
else
alias /R %compath%aliases
endiff
rem toggle n > NUL
fastatkb 00
unset compath
Start the non-resident screen saver if I don't hit a key within 15
seconds of boot up.
inkey /W15 Are you there? %%x
(Don't waste the keystroke -- stack it for the prompt.)
iff "%x" ne "" then
keystack "%x"
unset x
goto exit
else
dazzle
goto exit
endiff
goto exit
:exit
quit
rem
rem **********************************************************************
rem * COMMON SUBROUTINES *
rem **********************************************************************
rem
rem SET UP ULTRAVISION
rem
:uvsetup
%drp%loadhi g:\uv\uv.com
%drp%loadhi g:\uv\prtsc.com
set uv=%ramd%
return
rem
rem FIND RAMDISK AND SETRAMD
rem
This subroutine works by going backward through the alphabet until
it finds the first (highest lettered) logical drive which is not
a network drive, is not a removable drive (I have a Bernoulli which
may or may not have its driver loaded), and is ready. That one is
the ramdisk. If my ramdisk driver is not loaded for some reason,
the highest lettered hard drive will be substituted automatically.
:setramd
set work=ZYXWVUTSRQPONMLKJIHGFEDC
set count=0
:ramdloop
set foo=%@substr[%work,%count,1]:
iff %@ready[%foo] == 1 .and. %@removable[%foo] == 0 .and. %@remote[%foo] == 0 then
set ramd=%foo
unset work count foo
goto ramdexit
else
set count=%@eval[%count+1]
endiff
iff %count lt 24 then
goto ramdloop
else
set ramd=%_boot\ramdisk
unset count work foo
goto ramdexit
endiff
:ramdexit
return
rem
rem SET CDPATH
rem
This subroutine builds the CDPATH variable for all non-diskette disks
in alphabetical order. CDPATH is the foundation of drive letter
independence demonstrated in other examples.
:cdpath
set work=CDEFGHIJKLMNOPQRSTUVWXYZ
set count=1
set cdpath=C:\
:cdloop
set d=%@substr[%work,%count,1]:
if %d gt %[_lastdisk]: goto cdexit
if %@eval[%@ready[%d]+%@removable[%d]] gt 0 set cdpath=%[cdpath];%d\
set count=%@eval[%count+1]
goto cdloop
:cdexit
unset work count d
return