Unix emulation batch files
You can download the following code samples in zipped form as
unixemu.zip.
RM.BAT 441 15/01/96 15:57
Deletes files, using Dos\Ndos extensions where possible. Rather than deleting,
it moves to the unix wastebasket, though the delete commands are there, if
needed, but are commented out.
MV.BAT 286 13/05/95 11:02
Moves files, using Dos\Ndos extensions where possible. Requires the move
command. If you want to modify it to use the copy and del commands,
go ahead, but you're better off upgrading your version of Dos.
BG.BAT 189 15/01/96 15:57
Runs commands given as arguments in the "background". Requires windows 95.
LS.BAT 449 17/04/95 23:23
Pretty-printing wide display from the 'dir' command.
RM.BAT
@echo off
REM An alias for delete. In Ndos it will use all the arguments passed, but
REM in Dos it will only use the first 9.
REM Included for Unix compatibility, and also to encourage use of
REM the wastebasket, rather than fully deleting the files.
if "%@eval[1+1]"=="2" goto ndosrm
:dosrm
::del %1 %2 %3 %4 %5 %6 %7 %8 %9
move /y %1 %2 %3 %4 %5 %6 %7 c:\recycled
goto end
:ndosrm
::del %&
move %& c:\recycled
:end
MV.BAT
@echo off
Rem An alias for move. In Ndos it will use all the arguments passed, but
Rem in Dos it will only use the first 9. Included for Unix compatibility.
if "%@eval[1+1]"=="2" goto ndosmv
:dosmv
move /y %1 %2 %3 %4 %5 %6 %7 %8 %9
goto end
:ndosmv
move /r %&
:end
BG.BAT
@echo off
:: Command line multitasking.
if "%1"=="/?" goto help
start /m command /c %1 %2 %3 %4 %5 %6 %7 %8 %9
goto end
:help
echo Command line "Multi-tasking".
echo For example,
echo bg pkunzip foo.zip
echo will unzip foo.zip in the background.
:end
LS.BAT
@echo off
REM A compressed version of dir. Checks whether NDos is loaded, and if so,
REM uses NDos' special flags to give a coloured display.
REM Included for Unix compatibility.
if "%1"=="/?" goto help
if "%1"=="-?" goto help
if "%1"=="/H" goto help
if "%1"=="-H" goto help
if "%@eval[1+1]"=="2" goto ndosls
:dosls
dir /w %1 %2 %3 %4 %5
goto end
:ndosls
dir /4 /a /l /v /o:gen %&
goto end
:help
dir /?
goto end
:end
return to index