>>> Some TIPS & BUGS from DIP-OS and batchfiles <<< - Update: 02/96 !!! Instruction: Linenumbers including colon, before batchlines, aren't for typing! If you see this batchline ... : 10: :off ......... you should type only: :off ----------------------------------------------------------------------------- 01. DIP-OS BUG ! Unusual and useless: "CD C:\SYSTEM " - don't forget the space behind the M. Invoke the command "DIR C:\SYSTEM" and examine the directory. Works till Bios 1.072. <-=*=-> 02. HOW TO CREATE AN UPPERCASED VARIABLE ! Use an ascii-character above 128 in the name of a variable, when you create a variable with the SET-command, and their definition will be uppercased. Works till Bios 1.130. <-=*=-> 03. HOW TO CREATE A BATCHFILE NAMED '.BAT' ! Wrote a batchfile TEST.BAT and rename it with "REN TEST.BAT .BAT". If you invoke "+", "-", "#" or many other single characters at the DOS-Prompt, ".BAT" get started. Works till Bios 1.130. <-=*=-> 04. HOW TO GET EDITOR AND TEXT BACK WITHOUT PORTDIV.COM ! Type at the prompt: "ECHO M>>filename.txt". Replace filename.txt by the name of your corrupted textfile. Start now the internal editor and delete the space/return-combination and the "M" at the end of your text. Useful only at Bios 1.072. <-=*=-> 05. HOW TO DISPLAY A SPACELINE ON SCREEN PER BATCHFILE ! Use the ECHO-command with the ascii-character 255. Works till Bios 1.130 and on PC's too. "ECHO." works only on PC's. <-=*=-> 06. HOW TO STOP A BATCHFILE ! Use this line: "GOTO :>NUL" This GOTO will stop a batchfile immediately without errormessage ! <-=*=-> 07. HOW TO MAKE A TIMELOOP IN BATCHFILES ! Use this line: "FOR %%A in (1 2 3) DO TYPE C:\CONFIG.SYS>NUL" <-=*=-> 08. HOW TO CHECK THE DIRECTORY PER BATCHFILE ! Use this line: "IF EXIST C:\SYSTEM\NUL.* ECHO The directory exist !" Works on PC too ! The line "IF EXIST C:\SYSTEM\NUL ECHO The directory exist !" is working only on PC's. Replace C:\SYSTEM by the wanted drive and directory. <-=*=-> 09. STRING CUTTING WITH C:\CUT.BAT ! (for example) 01: @echo %%1=%1 Start C:\CUT.BAT by invoking... C:\CUT.BAT.something - should display "%1=hing" C:\CUT.BA.something - should display "%1=ing" C:\CUT.B.something - should display "%1=ng" C:\CUT..something - should display "Bad command or program not found" C:\CUT.something - should display "%1=hing" <-=*=-> 10. IS THE BATCHFILE RUNNING AT DIP-OS ? (DIPOS.BAT for example) 01: @echo off 02: rem selfcall if not started by invoking: dIpOs.BaT 03: rem 04: if not %0==dIpOs.BaT if not %1.==.BaT. dIpOs.BaT 05: rem 06: rem Parameters at DIP-OS: %0 = dIpOs %1 = .BaT 07: rem Parameters at MS-DOS: %0 = dIpOs.BaT %1 = 08: rem 09: if %1.==.BaT. echo Your DOS is DIP-OS ! 10: rem saving the Operating System in variable OS: 11: if %1.==.BaT. set os=DIP-OS 12: if %1.==. echo Your DOS is NOT DIP-OS ! 13: rem saving the Operating System in variable OS: 14: if %1%os%.==. set os=MS-DOS This check could be necessary, because some combinations of batchcommands are working different on PC or are displaying an error message on PC ! Each line allone, of this lines, is ONLY good working on PoFo (DIP-OS): IF %1==L ECHO The letter L ! CD..>NUL MD C:\DOS>NUL FOR %%A IN (C:\DOS\*.*) DO ECHO C:\DOS\%%A TYPE C:\CONFIG.SYS /P APP /E OFF Tryout line per line in a batchfile on your PC and watch out what happens ! The same lines, but now written for PC (MS-DOS): IF %1.==L. ECHO The letter L ! IF EXIST ..\NUL CD .. IF NOT EXIST C:\DOS\NUL MD C:\DOS FOR %%A IN (C:\DOS\*.*) DO ECHO %%A TYPE C:\CONFIG.SYS | MORE EDIT REM OFF - no equal command at MS-DOS ! Tryout line per line in a batchfile on your PoFo and watch out what happens ! And now the same lines, but written for working on PoFo and PC too: IF %1.==L. ECHO The letter L ! IF EXIST ..\NUL.* CD .. IF NOT EXIST C:\DOS\NUL.* MD C:\DOS rem by using DIPOS.BAT, espacially variable OS: IF %OS%.==DIP-OS. FOR %%A IN (C:\DOS\*.*) DO ECHO C:\DOS\%%A IF NOT %OS%.==DIP-OS. FOR %%A IN (C:\DOS\*.*) DO ECHO %%A rem by using DIPOS.BAT, espacially variable OS: IF %OS%.==DIP-OS. TYPE C:\CONFIG.SYS /P IF NOT %OS%.==DIP-OS. TYPE C:\CONFIG.SYS | MORE rem by using DIPOS.BAT, espacially variable OS: IF %OS%.==DIP-OS. APP /E IF NOT %OS%.==DIP-OS. EDIT rem by using DIPOS.BAT, espacially variable OS: IF %OS%.==DIP-OS. OFF IF NOT %OS%.==DIP-OS. ECHO Switch off ! Place the following line into your AUTOEXEC.BAT on PoFo: SET OS=DIP-OS and this line into your AUTOEXEC.BAT on PC: IF %OS%.==. SET OS=MS-DOS ... if you run the same batchfiles on both systems. Reboot both systems now ! Now your batchfiles should check the variable OS, if the commands FOR, TYPE, APP, EDIT and OFF (or other special commands of MS-DOS or DIP-OS) should be used in the batchfile ! MS-DOS, PC-DOS, DR-DOS and NovellDOS seem to be equal !!! <-=*=-> 11. CHANGING DRIVE AND DIRECTORY AT ONCE ! (CDD.BAT for example) 01: @echo off 02: rem Drive & Directory should exist - now including rootdirectories !!! 03: if not exist %1\nul.* if not exist %1nul.* goto off 04: if exist %1\nul.* cd %1 05: if exist %1nul.* cd %1 06: if exist %1nul.* goto root 07: rem>%1\%1 08: goto drive 09: :root 10: rem>%1%1 11: :drive 12: if exist %1\c. set dv=c: 13: if exist %1c. set dv=c: 14: if exist %1\b. set dv=b: 15: if exist %1b. set dv=b: 16: if exist %1\a. set dv=a: 17: if exist %1a. set dv=a: 18: %dv% 19: :off 20: if exist c. del c. 21: if exist b. del b. 22: if exist a. del a. 23: set dv= 24: if not exist %1\nul.* if not exist %1nul.* echo %1 doesn't exist! Start with: CDD C:\SYSTEM <-=*=-> 12. HOW TO REALIZE THE CALL-COMMAND FOR DIP-OS 2.11 ! TEST.BAT: 01: @echo off 02: if %SUB%.==next. goto next 03: set prg=TEST.BAT 04: set sub=next 05: call tst2.bat Hello ! 06: :next 07: echo TEST.BAT is back ! 08: set prg= 09: set sub= CALL.BAT: 01: @echo off 02: shift 03: if exist %0 %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 04: echo %0 doesn't exist ! TST2.BAT: 01: @echo off 02: echo %0 %1 %2 %3 %4 03: if exist %prg% %prg% Start with: TEST.BAT <-=*=-> 13. COPY C:\CONFIG.SYS C:\SYSTEM>NUL ... doesn't work at PoFos with BIOS 1.030 or BIOS 1.052 ! So you couldn't hide the message "1 file copied" at these PoFos ! The piping to the NUL- Device is guilty - so don't pipe to NUL if you wish to copy something! <-=*=-> 14. MAXIMUM LENGTH OF A BATCHLINE IS 126 BYTES ! The rest will be executed as a batchline of its own. <-=*=-> 15. HOW TO PLACE THE SAME TEXT AT THE END OF ALL TEXTFILES ! Use this line: "FOR %%A in (*.TXT) DO ECHO (C)opyright by QWERTY>>%%a" This line doesn't work at MS-DOS ! <-=*=-> 16. THE VALUE OF FILES IN CONFIG.SYS ... don't be less then eight or you get the message "Unrecognized command in CONFIG.SYS" after rebooting. <-=*=-> 17. HOW TO SAVE THE ROM TO DISK ! Necessary: Debug or PoFobug, 265KB free diskspace Type: debug (or PoFobug) Type: N BIOS-P1.BIN Type: RCX Type: FFFF Type: RBX Type: 0001 Type: W E000:0 ...wait a few seconds... Type: N BIOS-P2.BIN Type: W C000:0 ...wait a few seconds... Type: Q ...That's all !... <-=*=-> 18. THE HIDDEN FILE OF THE CHKDSK-REPORT ! ... is a product of the command LABEL. There is no hidden file longer, if you kill the label with LABEL again. <-=*=-> 19. MAKEDIR AND CHANGEDIR AT ONCE ! (MDCD.BAT) 01: @echo off 02: if not %1.==. if not exist %1\nul.* md %1 03: if not %1.==. if exist %1\nul.* cd %1 04: if %1.==. echo Start with: MDCD new_directoryname <-=*=-> 20. HOW TO LEARN DIRECTORIES ! (C:\TO.BAT for example - PoFo & PC) 01: @echo off 02: if not %1.==. set op=%path% 03: if not %1.==. if %op%.==. goto off 04: if not %1.==. path=%1 05: if not %1.==. set @=%path% 06: if not %1.==. if %@%.==. goto off 07: if %1.==. echo Teaching directory: TO dos c:\dos 08: if %1.==. echo Changing directory: TO Dos 09: if %2.==. goto off 10: if not exist %2\nul.* goto off 11: echo if %%@%%.==%@%. if exist %2\nul.* cd %2>>c:\to.bat 12: echo if %%@%%.==%@%. set @=>>c:\to.bat 13: :off 14: if not %1.==. if %op%.==. echo Teaching or changing impossible: Environment is full ! 15: if not %op%.==. path=%op% 16: set op= IMPORTANT: Instead of "@", in the lines 05:, 06:, 11: and 12:, use an ascii-character above 127 !!!! For teaching directory: TO LOVE C:\TEXT\PRIVATE\LOVER For changing directory: TO love (will change fast to C:\TEXT\PRIVATE\LOVER) <-=*=-> 21. IMPOSSIBLE COMBINATION OF BATCHCOMMANDS ! Try this line: "IF NOT EXIST ABC.TXT ECHO SOMETHING>ABC.TXT" If ABC.TXT not exist, it will be created as an Zero-Length-File ! Try this line: "IF EXIST ABC.TXT ECHO SOMETHING>>ABC.TXT" If ABC.TXT exist, ABC.TXT wouldn't be changed ! <-=*=-> 22. ARE FILEEXTENSIONS USELESS ? (TEST.BAT for example) 01: @echo %%0=%0 %%1=%1 Try out these inputs now: TEST.BAT TEST.COM TEST.EXE TEST.123 TEST.here_i_am_! <-=*=-> 23. ILLEGAL FILENAMES ! It's impossible to create filenames including ASCII-characters above 127 on the PoFo. It's only possible on PC's ! <-=*=-> 24. HOW TO GET BETTER DOCUMENTATION IN BATCHFILES ! Begin the lines of documentation with three colons, because they are faster then REM-lines and your able to use "<" & ">": ::: Syntax: TEST <-=*=-> 25. HOW TO CHECK AND FORBID WILDCARDS '* ?' IN PARAMETER %1 ! Sometimes you wish to forbid wildcards, because the batchfile couldn't work with many files at the same time. Here is a solution called WILDCARD.BAT: 01: @echo off 02: if %1.==. goto err 03: if not exist %1 goto err 04: if exist %1 for %%a in (%1) do if not %1==%%a shift 05: if exist %0 for %%a in (%0) do if not %0==%%a shift 06: if %0.==. goto err 07: rem 08: rem place here your own batchlines: 09: rem 10: echo Parameter %%1 was %1 ! 11: :err 12: if not %0.==. if %1.==. echo Parameter %%1 is missing ! 13: if not %1.==. if not exist %1 echo The file doesn't exist ! 14: if %0%1.==. echo No wildcards (* ?) allowed ! The lines 07: till 10: could be deleted ! Test WILDCARD.BAT by invoking: WILDCARD *.BAT WILDCARD *.?AT WILDCARD W*.BAT WILDCARD wildcard WILDCARD <-=*=-> ----------------------------------------------------------------------------- Detected, written and uploaded by: Lars Aschenbach, Germany CompuServe: 100542,3711 Internet : 100542.3711@compuserve.com -=>>> Feel free for translation or spreading ! <<<=-