SENVAR.COM (c) Ed Schwartz ========================== SENVAR is a very short (511 byte) program for interactive setting of environment variables. General Syntax: =============== SENVAR [/opt] env_var [prompt string] SENVAR will display the prompt string (if one is specified) and then wait for one line of user input. This input will be assigned to the environment variable specified under env_var. Example: SENVAR test Please enter your input : will display "Please enter your input : " and then will assign the user input line to environment variable TEST I/O redirection and piping: =========================== SENVAR allows redirection of input and output as well as piping. Example: echo bla-bla-bla| SENVAR test will set the environment varible TEST=bla-bla-bla Note that echo bla-bla-bla| SENVAR test is different from echo bla-bla-bla | SENVAR test in so far that in the second case the blank before the "|" becomes part of the varible Example: SENVAR test < c:\autoexec.bat will assign the first line of autoexec.bat to the environment variable TEST Example: SENVAR test < c:\autoexec.bat > nul will suppress all screen output from SENVAR The options /E /1 /C /N : ========================= /E : (E = Empty) Normally SENVAR doesn't allow the input of an empty string (just a CR/LF). With the option /E this becomes possible. Input of an empty string will clear the specified environment variable. If the input string is not empty, the /E option will be ignored. Example: echo.| SENVAR /e test will clear the environment varable TEST echo hello| SENVAR /e test will set TEST=hello /1 : (1 = One, Single) With the option /1 spedified, SENVAR will not wait for an input *line*, but will wait for *one* keystroke and assign that character to the specified environment variable. Example: echo hello | SENVAR test will set TEST=h /C : (C = Clear) This option will clear the specified environment variable Example: SENVAR /c test will clear TEST SENVAR /c t* will clear all environment variables starting with "T" SENVAR /c ta* will clear all environment variables starting with "TA" SENVAR /c * will clear all environment variables SENVAR /c t?st will clear TEST, TAST, TTST etc SENVAR /c x??y will clear XXXY, XABY, XCDY etc /N : (N = Name) This option will interpret the user input as the name of an already existing environment variable and assign the *contents* of that (existing!) variable to the variable specified in the command line. Example: assume COMSPEC=C:\COMMAND.COM then if you enter "comspec" (without the quotes of course) after calling "SENVAR /n test", this will set TEST=C:\COMMAND.COM If you enter the name of a non-existing variable, SENVAR will beep and ignore that input. Caution: echo comspec| SENVAR /N test will set TEST=C:\COMMAND.COM However, if COMSPEC doesn't exist in this case, SENVAR will "hang". This is a DOS problem, not a problem of SENVAR. You may terminate SENVAR by pressing Ctrl-Break. To create SENVAR.COM copy the following code to file SENVAR.DEB Then call "DEBUG < SENVAR.DEB" from the command line. -------- start of code ------------- e 100 8B 16 16 00 8E C2 26 8E 06 2C 00 06 8C C0 48 8E e 110 C0 26 A1 03 00 07 B1 04 D3 E0 A3 E9 02 8B C8 33 e 120 C0 8B F8 F2 AE 26 38 05 75 F9 89 3E EB 02 BE 80 e 130 00 46 8A 14 80 FA 20 74 F8 80 FA 0D 74 51 80 FA e 140 2F 75 2C 46 8A 14 80 FA 31 75 04 88 16 E5 02 80 e 150 E2 5F 80 FA 43 75 04 88 16 E7 02 80 FA 4E 75 04 e 160 88 16 E6 02 80 FA 45 75 C8 88 16 E8 02 EB C2 56 e 170 E8 D5 00 74 11 8B 0E EB 02 2B CE 46 06 1F FC F3 e 180 A4 0E 1F 5E EB E9 80 3E E7 02 43 5E 56 75 02 CD e 190 20 46 80 3C 3D 75 FA 46 8A 14 80 FA 0D 74 0E 80 e 1a0 FA 40 75 03 E8 13 01 B4 02 CD 21 EB EA BA ED 02 e 1b0 B8 01 0C 80 3E E5 02 31 75 08 CD 21 A2 EF 02 EB e 1c0 05 90 B0 0A CD 21 80 3E EF 02 0D 75 0A 80 3E E8 e 1d0 02 00 75 BB EB 10 90 80 3E E6 02 00 74 2E BE EF e 1e0 02 E8 64 00 75 0E 5E B2 0D B4 02 CD 21 B2 07 CD e 1f0 21 E9 3A FF BE EF 02 26 8A 07 88 04 43 46 3C 00 e 200 75 F5 B8 EF 02 2B F0 8B C6 A2 EE 02 5E 56 E8 37 e 210 00 33 C9 8A 0E EE 02 03 C8 83 C1 02 03 CF 39 0E e 220 E9 02 7D 0B BA D3 02 B4 09 CD 21 CD 23 CD 20 8B e 230 C8 5E F3 A4 BE EF 02 8A 0E EE 02 F3 A4 32 C0 26 e 240 88 05 47 26 88 05 CD 20 8B DE 8A 04 3C 20 74 1A e 250 3C 0D 74 12 3C 3D 74 12 3C 61 72 07 3C 7A 77 03 e 260 80 24 5F 46 EB E4 C6 44 01 0D C6 04 3D 8B C6 40 e 270 2B C3 33 FF EB 28 90 8B F3 8B C8 41 F3 A6 E3 29 e 280 80 3E E7 02 00 74 0F 80 7C FF 3F 74 EF 80 7C FF e 290 2A 75 03 4E EB E6 47 26 80 3D 00 75 F9 47 26 80 e 2a0 3D 00 75 D3 8B DF 8B F7 C3 4F 8B DF 2B F8 8B F3 e 2b0 46 26 80 3C 00 75 F9 0B C0 C3 33 D2 B0 64 E8 07 e 2c0 00 B0 0A E8 02 00 B0 01 46 8A 34 80 EE 30 F6 E6 e 2d0 02 D0 C3 07 45 6E 76 2E 20 6F 76 65 72 66 6C 6F e 2e0 77 21 0D 0A 24 00 00 00 00 00 00 00 00 FF 01 00 e 2f0 0D 28 63 29 20 65 2E 73 63 68 77 61 72 74 7A r cx 1ff n senvar.com w q ---------- end of code ------------------------------ -- Ed Schwartz +------- e-mail --------------+--- s-mail ----+---- Phone/Fax ---------+ | schwartz@sunco.co.kp.dlr.de | DLR/RM-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 | | +-----------------------------+---------------+------------------------+