home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1995 November
/
PCWK1195.iso
/
inne
/
podstawy
/
dos
/
4dos
/
4uzytki
/
ez-btm11.exe
/
SETTEMP.BTM
< prev
next >
Wrap
Text File
|
1994-05-02
|
1KB
|
45 lines
:: SETTEMP.BTM
:: "Universal" procedure to determine where temporary files will be
:: created. If "temp" is not defined in your AUTOEXEC.BAT file, "temp"
:: will be defined as your ramdrive, if it exists. If it does not exist,
:: it will be defined as your current drive.
:: This procedure can be invoked from other batch files by "call". It
:: seems to solve the problem with the dubious "%_lastdrive" variable
:: for defining "temp", since %_lastdrive may also be a network drive,
:: or a CD-ROM drive.
:: Itamar Even-Zohar, itamarez@plato.tau.ac.il
::
:set_temp
if "%temp"=="" gosub setramd
:: (temporary drive will be defined %_lastdisk if it is not remote
:: or cd-rom drive.)
if not isdir %temp (set temp=^gosub setramd)
iff "%@substr[%temp,0,-1]" == "\" then
set temp=%temp%
else
set temp=%temp\
endiff
quit
:setramd
:: (finds the first non-remote available drive/disk)
set work=ZYXWVUTSRQPONMLKJIHGFEDC
set dr=%_lastdisk
:ramdloop
set place=%@index[%work,%dr]
if %_4ver lt 5 set n=0
if %_4ver ge 5 set n=1
iff %@removable[%dr] eq %n .and. %@cdrom[%dr] eq 0 .and. %@remote[%dr] eq 0 .and. %@ready[%dr] eq 1 then
set ramd=%dr
goto ramdname
else
set place=%@eval[%place+1]
set dr=%@substr[%work,%place,1]
endiff
if %place lt 24 goto ramdloop
:ramdname
set temp=%ramd:
if %_batch lt 2 unset work dr ramd place n
return