::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: :: :: INC.BAT :: :: :: :: Counter for Batch Files :: :: :: :: Syntax: call INC [EnvVariable] :: :: :: :: Every call to INC.BAT increments the specified environment :: :: variable. If no env. var. is specified, %COUNT% is taken as :: :: default. :: :: :: :: Ed Schwartz, 3/96 :: :: :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: @echo off if %1*==* %0 COUNT echo set {K}=%%%1%%>{INC}.BAT call {INC}.BAT echo shift>{INC}.BAT echo if not %%0*==%%{S}%%* {inc} %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9>>{inc}.bat echo set {S}=%%1>>{INC}.BAT set {TZ}= :init set {S}=%{K}% if %{S}%*==* set {S}=0 set {K}= :loop set {I}=%{S}% for %%f in (/%{I}%) do set {S}=%%f for %%f in (/%{I}%) do if %%f%{S}%==%{I}% set {K}=%{K}%%%f if not %{I}%==%{S}% goto loop if %{S}%==9 set {TZ}=0%{TZ}% if %{S}%==9 goto init call {INC} 0 1 2 3 4 5 6 7 8 9 set %1=%{K}%%{S}%%{TZ}% for %%f in (K I S TZ) do set {%%f}= ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: SI.BAT :: :: Syntax: SI :: :: creates six environment variables that :: contain DayOfWeek, Date, Time, :: Drive, Directory, and DOS-Version :: The exact format of the variables is :: country dependent, e.g. for GERMANY: :: :: DAY=Mon :: DATE=12.10.92 :: TIME=10:13:24 :: DRIVE=C: :: DIR=C:\BATCH :: VER=6.2 :: :: Ed Schwartz, Oct. 92 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: @if %1*==* echo off @set Day=%1 @set Date=%2 @set Time=%3 @set Drive=%5 @set Dir=%6 @set Ver=%9 @if %1*==* %comspec% /e:4097 /c %0 %0 > %temp%\{SI}.BAT @if %1*==%0* prompt call %0 $d $t $n: $p $v @call %temp%\{SI}.BAT sCD.BAT (c) Ed Schwartz ======================= sCD is an improved version of the DOS command CD. The syntax is the same as for CD with one difference: There *must* be a blank between sCD and the directory (e.g. sCD \). sCD will change the directory *and* the drive if one is specified; moreover, after changing the directory with sCD you may press Shift-F10 to switch back to the previous directory. Thus, pressing Shift-F10 repeatedly will toggle between two directories. @set op=%prompt% @if not %1*==* prompt $e[2A$e[0;93;"%0 $p";13p @echo off prompt %op% cd %1 ctty nul %1\ ctty con Please note that the blank line in the batch is mandatory! sPATH.BAT (c) Ed Schwartz ============================ sPATH.BAT is an improved version of the DOS command PATH. Syntax: sPATH [path] If you don't specify a path, sPATH will assume the path that is currently setset Call sPATH only once, and afterwards, every time you press Shift-F9 you will be able to edit the PATH on the screen, just as you can edit any command line. Note: sPATH needs ANSI.SYS and DOSKEY. If you use the normal DOS PATH command AFTER you have "loaded" sPATH.BAT, this will allow you to enter a "different" PATH. Pressing then Shift-F9 will you bring back to the previous path. sPATH itself MUST be in the current directory or in a directory scanned according to the actual PATH because it is called every time you press Shift-F9. @echo off if not %1*==* path; :label shift path %path%%0; if not %1*==* goto label echo Esc[0;92;"sPATH %path%"p FSET.COM (c) Ed Schwartz ========================== Replaces the environment with the contents of the specified ASCII file. Syntax: FSET < ASCII_File ASCII_File is a text file that is structered like the output of the SET command (SET > ASCII_File) and *must* be terminated by a blank line. Note that any blank line within ASCII_File will termiate FSET. If ASCII_File is longer than the environment space, it will be truncated. Be sure to enter the names of environment variables in capitals! If "< ASCII_File" is ommitted in the above syntax example, FSET looks for input from the kbd. As with a file, kbd input is terminated with a blank line. With the folowing batch you may create your own environment editor: @echo off set > env.txt EDIT env.txt echo.>> env.txt FSET < env.txt ------------------------------------------------ Save the following code to FSET.DEB; then call DEBUG < FSET.DEB This will result in a file FSET.COM. Finally delete FSET.DEB Please note that the blank line in the code is mandatory ! ------ cut here ------------------------------------------ N FSET.COM A 100 MOV ES,[0016] ES: MOV ES,[002C] PUSH ES MOV BX,ES DEC BX MOV ES,BX ES: MOV BX,[0003] POP ES MOV CL,04 SHL BX,CL SUB BX,+03 MOV DI,0000 MOV DX,0160 MOV AH,0A INT 21 MOV DL,0A MOV AH,02 INT 21 MOV SI,0161 INC SI MOV DL,[SI] CMP DL,0D JZ 0159 CMP DL,1A JZ 0159 CMP DL,0A JZ 012F CMP DL,0D JNZ 0148 XOR DL,DL ES: MOV [DI],DL CMP DI,BX JZ 0159 INC DI OR DL,DL JZ 011F INC SI MOV DL,[SI] JMP 0141 ES: MOV WORD PTR [DI],0000 INT 20 DB FF r cx 61 w q ----------- cut here ------------ CENV.COM (c) Ed Schwartz =========================== CENV will delete the specified environment variables. Syntax: CENV var_1 [var_2 ... var_n] More than one variable may be specified with one call to CENV and the variable names may contain wildchars. will delete CENV * the entire environment CENV CO* all env. vars starting with CO CENV ??? all env. vars with name length of 3 chars CENV CO?? COLT, CONF, COXX etc CENV C?M? COMM, CLM1, CXMY etc ------------------------------------------------ Save the following code to CENV.DEB; then call DEBUG < CENV.DEB This will result in a file CENV.COM. Finally delete CENV.DEB Please note that the blank line in the code is mandatory ! ------ cut here ------------------------------------------ N CENV.COM A 100 MOV ES,[16] ES: MOV ES,[2C] XOR CX,CX MOV SI,80 MOV CL,[SI] MOV DX,81 MOV AX,6521 INT 21 JB 18A INC SI CMP BYTE PTR [SI],20 JZ 11A CMP BYTE PTR [SI],D JZ 18A MOV BX,SI MOV AX,2 INC SI INC AX CMP BYTE PTR [SI],20 JZ 13A CMP BYTE PTR [SI],D JNZ 12A MOV BYTE PTR [SI+1],D MOV BYTE PTR [SI],3D XOR DI,DI JMP 162 PUSH DI MOV CX,AX MOV SI,BX REPZ CMPSB JCXZ 170 CMP BYTE PTR [SI-1],3F JZ 146 CMP BYTE PTR [SI-1],2A JNZ 159 DEC SI JMP 146 INC DI ES: CMP BYTE PTR [DI],0 JNZ 159 INC DI POP CX ES: CMP BYTE PTR [DI],0 JNZ 141 INC SI CMP BYTE PTR [SI],3D JNZ 168 JMP 11A INC DI ES: CMP BYTE PTR [DI],0 JNZ 170 INC DI POP SI ES: MOV CL,[DI] ES: MOV [SI],CL INC SI INC DI ES: CMP WORD PTR [DI-2],0 JNZ 179 JMP 13D INT 20 R CX 8C W Q ------ cut here ------------------------------------------ ENVINFO.COM (c) Ed Schwartz ============================== Will display environment info like: Env. Length: xxx Used : yyy "xxx" denotes the reserved environment space (no of bytes), and "yyy" gives the number ob bytes already used. Note that every env. entry is terminated by an ASCI-0; thus every entry is one byte longer as ist seems to be. ENVINFO takes care of this fact. ------------------------------------------------ Save the following code to ENVINFO.DEB; then call DEBUG < ENVINFO.DEB This will result in a file ENVINFO.COM. Finally delete ENVINFO.DEB Please note that the blank line in the code is mandatory ! ------ cut here ------------------------------------------ n ENVINFO.COM a 100 MOV ES,[16] ES: MOV AX,[2C] PUSH AX DEC AX MOV ES,AX ES: MOV AX,[3] POP ES MOV CL,4 SHL AX,CL MOV CX,AX MOV DX,14F CALL 12F XOR AX,AX MOV DI,AX JMP 125 REPNZ SCASB ES: CMP [DI],AL JNZ 123 MOV AX,DI MOV DX,15F PUSH AX MOV AH,9 INT 21 POP AX XOR DX,DX MOV BX,A DIV BX PUSH DX CMP AX,0 JZ 145 CALL 135 POP AX ADD AL,30 MOV DL,AL MOV AH,2 INT 21 RET DB D,A,"Env. Length: $" DB D,A,"used : $" r cx 6F w q ------------ cut here --------------------------- Ed Schwartz +------- e-mail --------------+--- s-mail ----+---- Phone/Fax ---------+ | schwartz@sunco.co.kp.dlr.de | DLR/RB-CTC | Tel.: (0)2203-601 2648 | | Edwin.Schwartz@dlr.de | Linder Hoehe | Fax : (0)2203-601 2701 | | | D-51147 Koeln | | | http://www.dlr.de | Germany | | +-----------------------------+---------------+------------------------+