home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1995 November
/
PCWK1195.iso
/
inne
/
podstawy
/
dos
/
4dos
/
4uzytki
/
4dtip2.exe
/
DO.BTM
next >
Wrap
Text File
|
1992-07-06
|
11KB
|
401 lines
@ECHO off
if "%1" == "" goto help
goto %1
quit
REM ───────────────────────────────────────────────── Help
:help
echo.
echo Usage: DO function [options]
echo.
echo where function stands for
echo.
echo fullback - Full Backup
echo incrback - Incremental Backup
echo rest - Restore
echo.
echo chkdsk - Check disk
echo vircheck - run virus checker (f-prot)
echo.
echo normal - Reset to 4DOS environment
echo.
echo ho - Set home directory / change to home directory
echo.
echo hack - NetHack
echo info - shows some system information
echo.
quit
REM ───────────────────────────────────────────────── Disk oriented routines
REM ------------------------------------------------- Full Backup
:fullback
setlocal
unalias *
set fg=%_fg
set bg=%_bg
gosub GetDrive
color bright white on black
echo Full Backup of Drive %DRIVE% named %@LABEL[%DRIVE%].
color %fg on %bg
cd \
gosub CleanUp
gosub DoVirCheck /quick
:retry
del /q \backup.log
C:\DOS\backup %DRIVE% A: /s /l
set job=Backup
gosub ReportSuccess
if %YesNo% == Y GOTO retry
endlocal
quit
REM ------------------------------------------------- Incremental Backup
:incrback
setlocal
unalias *
set fg=%_fg
set bg=%_bg
gosub GetDrive
color bright white on black
echo Incremental Backup of Drive %DRIVE% named %@LABEL[%DRIVE%].
color %fg on %bg
gosub CleanUp
gosub DoVirCheck /quick
C:\TOOLS\newfiles /tot %DRIVE%
:retry
C:\DOS\backup %DRIVE% A: /m /s /a /l
set job=Backup
gosub ReportSuccess
if %YesNo% == Y GOTO retry
endlocal
quit
REM ------------------------------------------------- Restore
:rest
setlocal
unalias *
set fg=%_fg
set bg=%_bg
gosub GetDrive
set DIRNAME=%@SUBSTR[%@FULL[%2],2,255]
set DIR=%@UPPER[%@PATH[%DIRNAME%]]
iff %@INDEX[%2,*] GE 0 .OR. %@INDEX[%2,?] GE 0 THEN
set ISAMBIG=Y
else
set ISAMBIG=N
endiff
color bright white on black
echo Restoring %DRIVE%%DIRNAME%...
color %fg on %bg
iff %ISAMBIG%==Y then find /I "%DIR%" %DRIVE%\backup.log|more.com
else find /I "%DIRNAME%" %DRIVE%\backup.log|more.com
endiff
color bright white on black
echo Please insert appropriate disk.
color %fg on %bg
iff %ISAMBIG%=Y then C:\DOS\restore A: %DRIVE%%DIRNAME% /s /p
else C:\DOS\restore A: %DRIVE%%DIRNAME% /p
endiff
set job=Restore
gosub ReportSuccess
endlocal
quit
REM ------------------------------------------------- CHKDSK
:chkdsk
gosub DoChkDsk
quit
REM ------------------------------------------------- Virus Check
:vircheck
setlocal
unalias *
set fg=%_fg
set bg=%_bg
gosub GetDrive
gosub DoVirCheck
endlocal
quit
REM ─────────────────────────────────────────── Environment oriented routines
REM ------------------------------------------------- Normal Environment
:normal
unset *
set /r C:\4DOS\environ
alias /r C:\4DOS\aliases
echo 4DOS-Configuration read.
quit
REM ------------------------------------------------- Home
:ho
iff "%2" == "" then
echos Changing to %@upper[%home%]...
cdd %home%
else
setlocal
*set home=%@upper[%@full[%2]]
*unset /q tmp temp cmdline comspec
iff %@index[%@upper[%path],G:\] GE 0 then
*set path=%@substr[%path,4,255]
endiff
echo New Home directory will be: %home%.
*set > c:\4DOS\environ.
endlocal
*set /r C:\4DOS\environ.
endiff
quit
REM ─────────────────────────────────────────────────────────── Applications
REM ------------------------------------------------- NetHack
:hack
setlocal
unalias *
iff "%2"=="" then C:\NETHACK\nhack
else
iff "%4" == "c" then set term=ibmpc
elseiff "%4" == "m" then set term=ibmpc-mono
else
inkey /K"CM" /W5 [C]olor or [M]ono ? %%ask
set ask=%@UPPER[%ask]
iff "%ask" == "C" then set term=ibmpc
else set term=ibmpc-mono
endiff
endiff
IFF %@READY[G:] == 1 THEN
ECHO Installing NetHack on RamDisk G:
cdd g:\
except (4*.* acd.*) del /sxy G:\*.* >& NUL:
*md SAVE
cdd c:\NETHACK
set size=%@FILESIZE[C:\NETHACK\SAVE\SAVE2\%2.SAV,K]
iff "%size" GT "300" then
copy /q normhack.cnf nethack.cnf
set hackmode=0
elseiff "%size" GT "200" then
copy /q halfhack.cnf nethack.cnf
set hackmode=50
else
copy /q fullhack.cnf nethack.cnf
set hackmode=100
endiff
ELSE
copy /q normhack.cnf nethack.cnf
set hackmode=0
ENDIFF
:restore
iff %hackmode=0 then
copy /q C:\NETHACK\SAVE\SAVE2\%2.SAV C:\NETHACK\SAVE
elseiff %hackmode=50 then
copy /q halfhack.cnf nethack.cnf
copy /q C:\NETHACK\SAVE\SAVE2\%2.SAV C:\NETHACK\SAVE
else
copy /q fullhack.cnf nethack.cnf
copy /q C:\NETHACK\SAVE\SAVE2\%2.sav G:\SAVE
endiff
:goon
C:\NETHACK\nhack %2-%3
iff %hackmode% GT 50 then move /q G:\SAVE\%2.sav C:\NETHACK\SAVE\SAVE2
else move /q C:\NETHACK\SAVE\%2.sav C:\NETHACK\SAVE\SAVE2
endiff
inkey /K"YN " /W5 Try again (Y/N) ? %%ask
set ask=%@UPPER[%ask]
iff "%ask" == "Y" .OR. "%ask" == " " then goto /I restore endiff
echo.
endiff
endlocal
quit
REM ─────────────────────────────────────────────────────────── Jokes
:info
setlocal
set alias=%_alias
unalias *
set fg=%_fg
set bg=%_bg
cls
drawbox 0 0 %@eval[%_ROWS-1] %@eval[%_COLUMNS-1] 0 white on Cyan fill Cyan
vscrput 10 0 black on white 4DOS INFO
vscrput 10 %@eval[%_COLUMNS-1] black on white 4DOS INFO
drawbox 2 2 8 46 1 black on white fill white shadow
color black on white
screen 2 15 [Environment]
screen 3 3 You are running
scrput 3 19 red on white 4DOS %_4VER
screen 3 28 under
scrput 3 34 red on white %_DOS %_DOSVER
screen 3 42 .
screen 5 3 Free Environment Space : %_ENV Bytes
screen 6 3 Free Alias Space : %ALIAS Bytes
iff %_ANSI == 0 then screen 7 3 ANSI.SYS not installed.
elseiff %_ANSI == 1 then screen 7 3 ANSI.SYS will be supported.
endiff
drawbox 2 49 8 75 1 bright yellow on green fill green shadow
color bright yellow on green
screen 2 59 [Hardware]
screen 3 50 CPU :
scrput 3 63 bright white on green %_CPU
screen 4 50 Coprocessor:
scrput 4 63 bright white on green %_NDP
screen 5 50 Video card :
scrput 5 63 bright white on green %@UPPER[%_VIDEO] (%_COLUMNS%x%_ROWS%)
screen 7 50 Actual Codepage is %_CODEPAGE%.
drawbox 10 2 15 75 1 bright white on blue fill blue shadow
color bright white on blue
screen 10 20 [Memory]
screen 11 3 Available Conventional memory:
scrput 11 34 bright yellow on blue %@DOSMEM[b] Bytes.
screen 12 3 Available XMS memory:
scrput 12 34 bright yellow on blue %@XMS[b] Bytes.
screen 12 50 Extended:
scrput 12 61 bright yellow on blue %@EXTENDED[b] Bytes.
screen 13 3 Available Expanded memory:
scrput 13 34 bright yellow on blue %@EMS[b] Bytes.
iff %_win == 0 then scrput 14 3 white on blue Windows is not running.
elseiff %_win == 1 then scrput 14 3 white on blue Windows is running. (in real!! mode)
elseiff %_win == 2 then scrput 14 3 white on blue Windows is running. (in standard mode)
elseiff %_win == 3 then scrput 14 3 white on blue Windows is running. (in enhanced mode)
endiff
drawbox 17 2 23 37 1 bright white on Magenta fill Magenta shadow
color bright white on Magenta
screen 17 15 [Harddisks]
iff %@ready[C:] == 1 then ^ screen 18 4 Free Space on Drive C: %@DISKFREE[C:,m] MB. ^ endiff
iff %@ready[D:] == 1 then ^ screen 19 4 Free Space on Drive D: %@DISKFREE[D:,m] MB. ^ endiff
iff %@ready[E:] == 1 then ^ screen 20 4 Free Space on Drive E: %@DISKFREE[E:,m] MB. ^ endiff
iff %@ready[F:] == 1 then ^ screen 21 4 Free Space on Drive F: %@DISKFREE[F:,m] MB. ^ endiff
iff %_LASTDISK GE G .and. %@ready[G:] == 1 then ^ screen 22 4 Free Space on Drive G: %@DISKFREE[G:,m] MB. ^ endiff
drawbox 17 40 20 75 1 white on black fill black shadow
color white on black
screen 17 50 [Date & Time]
screen 18 41 %_DOW, the %_DATE at %_TIME.
color black on white
screen %@eval[%_ROWS-1] 2 Press a key to abort...
inkey %%dummy
cls
endlocal
quit
REM ══════════════════════════════════════════════════════ common subroutines
REM ------------------------------------------------------ GetDrive
:GetDrive
iff "%2" == "" then set DRIVE=%_DISK:
else set DRIVE=%@SUBSTR[%@FULL[%2],0,2]
endiff
set DRIVE=%@UPPER[%DRIVE%]
return
REM ------------------------------------------------------ CleanUp
:CleanUp
echos Deleting *.BAK,*.TMP and .$$$ files...
del /s \*.bak \*.tmp \*.$$$ >& NUL:
echo Done.
iff %DRIVE% == C: then
echos Deleting contents of C:\TEMP...
del /yz C:\TEMP\*.* >& NUL:
echo Done.
elseiff %DRIVE% == E: then
echos Deleting contents of E:\WINDOWS\TEMP...
del /yz E:\WINDOWS\TEMP\*.* >& NUL:
echo Done.
endiff
echo.
gosub DoChkDsk
echo.
return
REM ------------------------------------------------------ ReportSuccess
:ReportSuccess
if errorlevel == 4 goto error
if errorlevel == 3 goto abort
if errorlevel == 2 goto conflict
if errorlevel == 1 goto no_files
if errorlevel == 0 goto success
:error
color bright white on black
echo %job stopped due to an error.
color %fg on %bg
inkey /K"YN" Retry (Y/N) ? %%YesNo
set YesNo=%@UPPER[%YesNo%]
goto exit
:abort
echo You just pressed Control-C to stop the %job.
goto exit
:conflict
color bright blink yellow on red
iff %job == Backup then
echo One or more files were not backed up due to a file sharing conflict.
else
echo One or more files were not restored due to a file sharing conflict.
endiff
color %fg on %bg
echo This error message should not have appeared, share is not loaded!
goto exit
:no_files
echo Sorry, but there were no files to %job.
goto exit
:success
echo This %job was successful.
if %job == Backup echo %@DISKFREE[A:,K] KBytes free on last Backup disk.
c:\dos\mirror %DRIVE%
:exit
return
REM ------------------------------------------------------ DoChkDsk
:DoChkDsk
keystack N 13
C:\DOS\chkdsk.exe /f %2&
keystack !
return
REM ------------------------------------------------------ DoVirCheck
:DoVirCheck
iff exist %drive\f-prot.log .and. %@filedate[%drive\f-prot.log] == %_date then
echo You have already made a vircheck today.
else
C:\ANTIVIR\f-prot %drive /report=%drive\f-prot.log
iff errorlevel gt 0 then
drawbox 5 10 15 72 2 bright white on red fill red
scrput 7 12 bright yellow on red f-prot 2.03a reports, that
scrput 7 39 bright blink yellow on red YOU MAY HAVE CAUGHT A VIRUS!!!!!!
scrput 9 12 white on red 1) keep cool,
scrput 10 12 white on red 2) disinfect your harddisk, before making any Backups.
scrput 11 12 white on red 3) remember: your backups may also be infected,
scrput 12 24 white on red so re-run f-prot.
scrput 14 12 bright white on red press ESC to acknoledge.
inkey /k"[esc]" %%dummy
cls
endiff
endiff
return