                                   The

                            Fabulous BatPower

         ####       ####        ###    ###         ##########
         #####     #####        ###    ###         ##########
         ### ##   ## ###        ###    ###         ###
         ###  ## ##  ###        ###    ###         ########
         ###   ###   ###        ###    ###         ########  
         ###    #    ###        ###    ###         ###
         ###         ###        ###    ###         ###
         ###         ###  ##    ##########   ##    ###     ##
         ###         ###  ##     ########    ##    ###     ##  (c)

                                   List 

                    (MicroSoft's Undocumented Features)

                            Volume 1  Number 7

===============================================================================
1) ATTRIB

ATTRIB ,

 To remove all file attributes, from files in the directory you are
 in, type:

  attrib ,

 Works for dos 5 and above... be careful with this one... I haven't
 tried it with the /s extension.

                              Frank Ganje


ATTRIB ,|ECHO Y|DEL *.*

 I originally put forward the above suggestion. It was a one line
 command that could delete ALL files in the current directory. But
 of course there is no point in typing it in at the dos prompt as
 the person is there to press y at the right time. In a batch file
 you would naturally split this command in two.

 "Attrib ," can be used with the /S switch, so if entered in the
 root directory you could reset _ALL_ attributes of _ALL_ files on
 the _ENTIRE_ drive.

                              Richard Gallagher


 Does this really work? I tried a previous suggestion, and it
 didn't. I don't see the reason to pipe the attrib output to the
 echo command.

                              Bruce Bowman


 Worked fine here, took out all the files (system, hidden, read-only),
 like a dream with no lock up, using MSDos 5.0

                              Terry Kreft


 What version of DOS do you have? It works fine with DOS 5.

 This is one way of stacking multiple commands on one line.

 It is not really piping the output of attrib to echo. Using the
 pipe is one way of stacking multiple commands on a line. All the
 "attrib ," does is reset _ALL_ attributes on _ALL_ files in the
 current directory. So if you were to run that from the root of
 your c: drive you would no longer have a bootable drive.

                              Jim Banghart


(EDITOR'S NOTE: See the Multiple DOS Commands per Line section
for additional information)


 I use DOS 5 also, and it doesn't always work. I do not recommend
 this practice. It does attempt to pipe the output of attrib to echo,
 and thus writes a file to the directory specified by the environment
 variable TEMP. If you try to run this program in your TEMP directory,
 you will get a sharing violation. It also actually slows your program,
 because it has to write and delete a useless file (unless you have
 your TEMP on a ramdisk).

 I can't say I see much reason for stacking commands like this - put
 the commands on separate lines. A character is a character, be it a
 carriage return or a pipe, and your files will be easier to
 understand.

 Try running it in your TEMP directory. You will get a share violation
 because ATTRIB will write a file to that directory. Better to split
 the commands on two lines; avoid fostering bad habits.

                              Bruce Bowman


 This does not work under Desqview. If you want to use it under DOS it
 can also be shortened to:

   attrib,|echo y|del.

                              Terry Blount


 It depends on what directory you run it in. DV hooks the interrupts
 for fatal errors and sharing violations, so it catches errors better
 than DOS does. Try running it somewhere other than your TEMP directory,
 or the directory in which your batch file resides, and it should work
 okay.

                              Bruce Bowman



ATTRIB +H

 Is there anyway to create a hidden directory on a hard drive?

 I've since learned that DOS 5.0 ATTRIB can do the same thing
 from the command line:

   ATTRIB +h dirname

                              Gary Smith

===============================================================================
2) CALL

 The DOS 5.0 manual, in the command reference for CALL, states:

   Syntax: call [drive:][path]filename [batch-parameters]

   Parameters [drive:][path]filename

   Specifies the name and location of the batch program you
   want to call. Filename must have a .BAT extension.

 The latter sentence is not true in DOS 5.0. CALL works
 equally well whether "filename" is a .BAT, .COM, or .EXE
 file, or even internal command the following all work
 just fine:

   call dir
   call mem
   call tree
   call echo Phhhhhhht!

                              Gary Smith


 Is it safe to use CALL filename even if filename is a .COM or an .EXE
 file as opposed to a .BAT file? I know it works; I'm just curious if
 it's not good to do so.

                              George Steinmetz


 The MS-DOS dox are silent on the issue, but I have done it on a number
 of systems in just the situation you describe, where I didn't know in
 advance if a .COM, .EXE, or .BAT file would be called.

 I have *never* had a problem with it, and it doesn't seem to use any
 more memory either.

                              Gary Novosielski


 As far as DOSKEY macros go, I don't think you can run them from
 batch files so they're no problem.

                              Erik Ratcliffe 


 I can confirm that, Erik. The DOSKEY command can be used within a
 batch file to create a macro, but you cannot run a macro from a
 batch file.

                              John Evans


 I beg to differ, since no-one else appears to have jumped in on this
 one. Try the following:

   @echo off
   doskey fred=dir/w
   echo fred | call

                              Rudy Lacchin


 The online Help states quite clearly that it is _not_ possible to
 run a macro from within a batchfile.

 OTOH, "echo", "|" and "call" are all documented, so one could argue
 that it falls under the category "tips and tricks".

 What puzzles me is that "call {macroname}" doesn't work but "echo
 {macroname} | call" does?!?

                              John Evans


 This puzzled me at first but isn't this what is happening; when you
 put CALL FRED, then CALL is looking for an executable (com,bat,exe
 file) to call, as it doesn't exist it fails (Bad Command...(?)), but
 ECHO FRED|CALL, actually sends the output of FRED which is dir/w to
 call and so as dir/w is a valid call statement it succeeds.

 To prove this I made batch files with the following commands, which
 gave the associated results:

   doskey fred=dir/w       Succeeded and gave a dir/w listing.
   echo fred|call

   doskey fred=dir/w       Failed with a "Bad command or filename"
   call fred               error.

   call dir/w              succeeded and gave a dir/w listing

 So I think my reasoning is correct. First time for everything.

                              Terry Kreft

===============================================================================
3) CHKDSK

EDITOR'S NOTE:

Technically the following information is NOT a MUF, but is included
here due to the fact that it may help save someone a lot of grief!
Similar to advising others not to use delayed cache writes and DOS
6.0's DoubleSpace.

CHKDSK

 Can you tell me the _date_ of the BAD CHKDSK? I live in
 fear of it as I mainly work on other peoples computers an I
 have no way of telling if I will destroy their HD with a
 simple chkdsk command!

                              Wallace Mcgee


 The only problem with CHKDSK is with large partitions where DOS uses
 a 256-sector FAT. Specifically with partition sizes in the ranges of:

    127MB-129MB
    254MB-258MB
    508MB-516MB
   1018MB-1030MB
   2035MB-2061MB

 The date of the CHKDSK that has that problem is 04/09/91. The
 replacement being dated 11/11/91.

 UNDELETE has the same problem for the same reason.

 Bottom line is - if you don't have partitions in these size ranges -
 you don't have a problem.

 The corrected versions can be had by downloading from the MS BBS.
 Probably also available off of CompuServ. The file to look for is:
 PD0646.EXE. The phone number for the MS BBS is (206) 936-6735.

 Hope that helps you and others with the same question.

                              Steve Osterday


 From Microsoft:

 INTRODUCTION

 The Microsoft MS-DOS CHKDSK and UNDELETE commands dated 04/09/91,
 which are included in the Microsoft MS-DOS 5 Upgrade, do not work
 correctly on logical drives that require 256 sectors to store each
 copy of the file allocation table (FAT). If any of the partitions
 on your hard disk drive are within the ranges listed in the
 following section and you do not have version 5.0a of the
 Microsoft MS-DOS 5 Upgrade, which includes CHKDSK.EXE and
 UNDELETE.EXE files dated 11/11/91, install the updated CHKDSK.EXE
 and UNDELETE.EXE files included with this application note.
 If your FAT occupies 256 sectors, using the CHKDSK.EXE file dated
 04/09/91 with the /f parameter ("chkdsk /f" [without the quotation
 marks]) can result in data loss. Using the UNDELETE.EXE file dated
 04/09/91 can lead to unpredictable results.

 DETERMINING IF YOU NEED TO INSTALL THE UPDATED FILES

 Drives require a 256-sector FAT if they have partitions within the
 size ranges listed below. Because the potential problems are serious,
 these ranges include a margin of safety.

    127 MB-129 MB
    254 MB-258 MB
    508 MB-516 MB
   1018 MB-1030 MB
   2035 MB-2061 MB

 You can use the Fdisk program to determine if you have a 256-sector
 FAT with the following procedure:

 1. At the MS-DOS command prompt, type the following and press the
    ENTER key:

    fdisk

 2. Press 4 on the keyboard to select the Display Partition Information
    option and press ENTER.

 3. The primary partition size is listed under the Mbytes heading. If
    the size falls within any of the ranges specified above, install
    the updated CHKDSK.EXE and UNDELETE.EXE files on the enclosed
    PD0646 disk.

 4. If you have an extended partition, press the ENTER key to view
    those partition sizes. If any of the extended partition sizes
    listed under the Mbytes heading fall within the ranges specified
    above, install the CHKDSK.EXE and UNDELETE.EXE files on the
    enclosed PD0646 disk.

 5. Press the ESC key twice to exit to the MS-DOS command prompt.

                              Posted by: Vernon Frazee


 In just about all versions of Dos (At LEAST Msdos though I've been
 told others have the same problem), You cannot normally use a hard
 drive which has more than 1024 Cylinders. It isn't a limitation of
 my BIOS since I can use these Cylinders in the Linux O/S with ease. 
 Dos Fdisk will only recognize up to 128 megs of the 152 meg priam
 MFM drive I have. Most IDE drives can have more than 1024 but they
 trick dos and the Bios into thinking they only have 1024. I was
 using a program called "Disk Manager V5" (nothing to do with Norton
 Utilities) which loaded a driver into memory to access the rest of
 the cylinders and do a "Fake" Fdisk. What I mean by that is it
 kept the info on the partition in a file for it's own use. It
 didn't actually access the partition on the Priam. Linux does but
 the MsDos "FORMAT" won't even deal with a partition that goes past
 the 1024 cylinders (Even if it IS there).

 Microsoft and IBM won't acknowledge it's existence and I may want
 to use this Hard Drive in Dos again sometime.

 I'm currently using Dos 6.20 (probably the most undocumented Dos of
 them all I would imagine.)

                              Sean Kearney

===============================================================================
4) CHOICE

 I blundered onto an interesting choice.com feature:

   CHOICE /C:XM*; /N /T:2,5
   if errorlevel=4 goto help
   if errorlevel=3 goto end
   ...etc

 The "*" is the escape key, and the ";" is F1 etc.

                              Robert Lindsay


 I can't reproduce the "feature".

 Particularly, the * does not recognize the Esc key. All I get
 is a beep. I'm using Choice.com from the DOS6SUPP archive
 (though under DOS 5.0).

 Later:

 It occurred to me I hadn't tried an actual Esc character (ascii 27,
 small left-pointing arrow). I did now, and it *does* work. You
 have to use an editor that allows you to enter an Esc character
 (most do, I think).

 I couldn't get the ";" to be recognized as a function key though.

                              Gerry Pareja


 The ";" is just part of the "ASCII code" for F1. F1 actually
 gives an ASCII 000, to mark an extended key, and then the
 semi-colon. CHOICE will beep at the 000, and then accept the
 semi-colon.

                              Scott Wunsch


 Since I am running DOS6, I shelled out when I read your msg and
 created TEST.BAT, whose command line is exactly as:

   CHOICE /C:XM*; /N /T:2,5

 with the insertion of the little ^[ symbol (lp arrow) for the *
 and F1 for the ;. When I executed TEST I got the following
 feedback:

   C:\PP\BW>CHOICE /C:XMF1 /N /T:2,5

 CHOICE: Timeout default not in specified (or default) choices.

 NOTE: Even tho the ^[ symbol does not show up, it was reconfirmed
 to be in TEST.BAT.

                              Bat Lang


 Here's a layman's attempt to throw some light on the matter:

 The above syntax will produce an error because of the "/T:2,5",
 but that's beside the point. My understanding of the above is
 that CHOICE interprets the keyboard scan code as an ASCII code.
 In other words, if the scan code for a particular key (or any
 part of it) corresponds to an ASCII character which can be used
 as an argument to the /C switch, then that key may be used with
 CHOICE.

 The second part of the scan code for F1 for instance is 59,
 which is the ASCII code for a semicolon. Therefore "CHOICE /C:ABC;"
 will accept either the semicolon key or the F1 key. If you press
 F1 a beep will sound because of the first part of the scan code,
 but the second part (59) is interpreted as a semicolon and is
 accepted.

 Another example: The code for "page down" is 81 which is the same
 as a "Q", so if q is one of the arguments to the /C switch,
 pressing "page down" will work as well (but with a preceding beep).

 The ESC character (scan code 01) doesn't fit in with the above
 theory, but works fine if represented by an ASCII 27 (left
 pointing arrow).

 Some ASCII equivalents to scan codes cannot be used with CHOICE.
 F2 and F4 for instance, both require a redirection symbol, which
 obviously can't work.

 Another drawback is that if (like mine) the f-keys have been
 allocated functions under DOS (via PROMPT), you get as many beeps
 as there are characters allocated (until one of the characters
 happens to coincide with one that CHOICE is expecting). My F12
 key, for instance, gives me 10 seconds of beeps. :-)

 Tested with MS-DOS 6.00.

                              John Evans


 F1 is an extended key. It doesn't actually have an ASCII code, as
 such, so the BIOS gives it an "ASCII code" of 0, or a null. After
 it sends the null, it sends the scan code of the key, so that
 programs can figure out which extended key it was. The scan code
 for F1 is 59 (the ASCII code for a semi-colon). So you enter the
 command:

   CHOICE /N/C:;

 CHOICE calls the BIOS and asks it to get it a key. You hit F1.
 The BIOS sends the null (ASCII 0) to mark an extended key. CHOICE
 doesn't like this and beeps. It goes back to the BIOS and asks for
 another key. Now the BIOS hasn't finished with the F1. It sends
 the semi-colon to tell CHOICE which extended key it was. Well,
 CHOICE isn't smart enough to figure out that ASCII 0 means an
 extended key, so it had just ignored it. Now it sees this
 semi-colon, and decides it must be a perfectly valid key.

 The function keys' "scan codes" are as follows:

   F1:  ; [059]
   F2:  < [060]
   F3:  = [061]
   F4:  > [062]
   F5:  ? [063]
   F6:  @ [064]
   F7:  A [065]
   F8:  B [066]
   F9:  C [067]
   F10: D [068]
   F11:  [133]
   F12:  [134]

 Obviously, you're not going to be able to use F2 or F4 in a batch
 file :(.

                              Scott Wunsch

===============================================================================
5) COM or EXE

 Also, have you noticed that 4DOS.COM (when viewed with LIST) begins
 with the letters "MZ"? Isn't that the mark of a .EXE file? Very
 interesting...

                              Thomas Smith


 It sure is, and that's an example of something else that may be
 a MUF. DOS doesn't care whether the extension on an executable
 file is .COM or .EXE. It looks at the beginning of the file and
 does the right thing according to what it finds.

                              Gary Smith


 The identifier of an EXE file does not have to be MZ, ZM will
 execute just fine too! (Other identifiers will not work however).

                              Jonas Oberg

===============================================================================
6) COMMAND, SHELL, and SYS

SHELL=C:\COMMAND.COM /E:1024 /F /P

COMMAND /F

 The /F in your Config.sys SHELL= statement is another undocumented
 feature.

 It forces a "Fail" response to the "Abort, Retry, Fail" prompt issued
 by the DOS critical error handler.

                              Dennis McCunney


 What is the /F for in your SHELL statement? My DOS manuals make no
 mention of an /F switch. It does mention that command line parameters
 accepted by the command processor can be passed via the shell
 statement. However, my DOS manuals make no mention of such a switch
 for COMMAND.COM either. Was that a typo?

                              Gary Cooper


 Nope,  It's another undocumented feature. What I believe it is
 supposed to do is force a "Fail" response to the "Abort, Retry, Fail"
 message issued by the DOS critical error handler. I run 4DOS, so I've
 had no occasion to actually test it.

                              Dennis Mccunney


 The /F switch on the SHELL command in CONFIG.SYS will not work in
 a DESQview environment. The only thing I have found that will is a
 program called FATAL.COM.

                              Bruce Bowman


 Makes all those annoying "Abort, Retry, Ignore, Fail?"
 disk error messages default to "Fail".

                              Erik Ratcliffe


 I thought this was well established as being available from v3.3
 I certainly use it with MSDOSv5.0a and its been mentioned since my
 early days in the echo back in Feb'93.

   E.G.

   @echo off
   if %1.==. goto syntax
   echo %comspec% /f /c copyprn$.bat>temp$$$$.bat
   echo copy %1 prn: >copyprn$.bat
   call temp$$$$.bat
   if exist ???????$.bat del ???????$.bat >nul
   goto end
   :syntax
   echo Usage: %0 [filename.ext]
   echo    Prints [filename.ext] if printer is ready.
   echo    If not terminates.
   :end

 I've posted this example usage myself - its handy if the printer is
 the other side of a wall and you can't see if its ready.

                              Mark J. Allen


 Yes, MS-DOS COMMAND.COM's "/F" parameter (default to Fail when
 it cannot read a disk) works on all versions since MS-DOS v3.30.

                              Vernon Frazee


 It certainly works with 3.3

                              Tom Coleman


 I've used it (successfully) with M$ Dos 5.0, 6.0, 6.2. I will
 retest, as well include some other versions of it. I figured
 that someone had re-covered it by now, however I will send you
 some NFO on it.

                              Steve Adams


 I first used it with 5.0.....and have used it with 6.0 and 6.2.

                              John Mudge


 I have just tested "command /f" in MSDOS 3.21 by booting from my
 original (1988) floppy. It worked!! I booted from A: drive, typed
 "ver" to confirm the version in use was MSDOS 3.21, typed command /f,
 switched default drive to C:, then opened the floppy door on A: and
 typed "dir A:". After a few seconds the Not ready reading Drive A:
 message appeared, about 5 seconds later I was returned to the "C:"
 prompt.

                              Pete Smith


 I normally run DOS 3.31 on an old XT, but in Swedish translation.
 It didn't work exactly as in your experiment. I wonder, if that
 is because the alternatives are not Abort, Retry, Fail, but Avbryt,
 Frsk igen, G vidare. Ie the "F" option is the "retry" option.

                              Ragnar StHle


 Since the infamous DOS error message "Abort, Retry, Ignore?" didn't
 become a more chilling "Abort, Retry, Ignore, Fail?" until DOS 3.3,
 COMMAND.COM's undocumented "/F" parameter (default to Fail) probably
 wouldn't have been discovered, if it existed, in earlier releases.

                              Vernon Frazee


   Microsoft(R) MS-DOS(R)  Version 3.20
               (C)Copyright Microsoft Corp 1981-1986

   A>c:\u2\ssxtra 5000 /q

   A>command /f

   Microsoft(R) MS-DOS(R)  Version 3.20
               (C)Copyright Microsoft Corp 1981-1986

   A>dir b:

   Not ready error reading drive B
   Abort, Retry, Ignore? Volume in drive B has no label

   Not ready error reading drive B
   Abort, Retry, Ignore?
   Not ready error reading drive B
   Abort, Retry, Ignore? Invalid drive specification

   A>

 My first computer was a Commodore XT clone with MS-DOS 3.2.
 I was using the /f switch then, and remember experiencing the
 same 30 second delay. I just booted up my 386 with v3.2 and
 tried the same thing. The delay was less than a second.
 Evidently, the delay factor depends more on hardware (and
 maybe BIOS) than the DOS version.

                              David Adamson


 I just shelled to invoke a COMMAND from a 2.0 floppy
 and it crashed my server!

   Tue  5-13-2* 8:16:08*A:\>c:\u2\ssxtra 5000

   *NOT* residentstatus=ONmode=ANYtimer=3INSTALLED
   (5000) buffer size requested, Available: (5014)

   Tue  5-13-2* 8:16:15*A:\>command /f

   Command v. 2.11

   Tue  5-13-2* 8:16:27*A:\>dir b:

   Not ready error reading drive B
   Abort, Retry, Ignore? f
   Abort, Retry, Ignore? f
   Abort, Retry, Ignore?

 (Captured/written-to-disk _at_ the Crit-Err prompt via SSXTRA
 ((fwiw I also command /F,a,A,i, and I with identical results))
 (((All DOS's "R"etry minimum 3 times before -> crit-err)))
 then....

   Microsoft(R) MS-DOS(R)  Version 3.20
                (C)Copyright Microsoft Corp 1981-1986

   A>c:\u2\ssxtra 5000 /q

   A>command /f

   Microsoft(R) MS-DOS(R)  Version 3.20
                (C)Copyright Microsoft Corp 1981-1986

   A>dir b:

   Not ready error reading drive B
   Abort, Retry, Ignore? Volume in drive B has no label

   Not ready error reading drive B
   Abort, Retry, Ignore?
   Not ready error reading drive B
   Abort, Retry, Ignore? Invalid drive specification

   A>

 w/ No intervention on my part at all, although it took over
 30" to get back to the prompt. So "/f" processing *is* present,
 if very shoddily implemented, in MS's 3.2. (which is also
 pretty darn buggy otherwise)

                              Don Hoffman


 YES "command /f" does work on MS-DOS 3.21.

                              Pete Smith


COMMAND /P

 Docs say that this doesn't allow you to exit back to the
 previous shell (ie /Permanent), but /P also forces
 \autoexec.bat to be run on secondary shells.


COMMAND /D

 (When used with a primary shell, or secondary with /P)
 prevents execution of \autoexec.bat

                              Mitch Ames


 I just checked, and these also both apply to DOS 5.00

                              Mitch Ames


COMMAND /E:

 ...remember the constantly returning thread of getting secondary
 shells' environments greater than 256 bytes? Well I had cause to
 mess around on someone's machine and needed a larger secondary
 shell from a pgm that didn't allow shell definition when it dawned
 on me that you can just modify the COMSPEC variable to include the
 trailing /e:#### and as most well behaved pgms use the comspec
 variable this works wonderfully!

                              Mark J. Allen


 I've never tried that. I thought I read someone here did that and
 it wasn't accepted by the program, but it sounds like an excellent
 solution.

                              Rob Flor


 Well, I had the same idea some time ago, but I can't report the
 same success as you had. :-( I experienced the whole range of
 inexplicable errors, crashed programs, system hangups, etc.

 Seeing as /E is a valid parameter for COMMAND.COM, It must be
 something to do with the (faulty?) way certain programmes
 handle the comspec variable.

                              John Evans


 I tried it for a day or so the last time the "how to increase the
 environment" went round.

 May just be my choices in s/w, but I didn't find a single pgm that
 was able to shell successfully via the adulterated comspec.

                              Don Hoffman


 Or you could do:

  COMMAND.COM /E:5000 /C C:\YOURAPP.BAT

 Single line, decrease/increase the environment as needed. No SET's
 needed.

 And as far as I can tell, it works just great under DOS5.0, when
 running DESQview, I run multiple windows, and am running a VBBS
 multinode system. When I shell out to DOS(in that window), the
 batch files I have running will not function if I DON'T change
 the /E: size, and in most cases lock up the system.

 However, I have never had a problem since using the above statement.
 What it is doing I can not say, but it sure works here!

                              Tony Talarigo



SHELL=COMMAND.COM /NUL

 Adding a "/NUL" to the SHELL= statement in CONFIG.SYS will remove
 the possibility of a user being able to use [Ctrl-C]. Example:

   SHELL=C:\DOS\COMMAND.COM C:\DOS /E:1024 /NUL /P
    
                              Vernon Frazee


SHELL=C:\COMMAND.COM C:\ /p
                     ~~~

 The second parameter tells the OS where to find the command processor
 when the transient code is overwritten. In addition, the inclusion of
 this parameter in the SHELL statement will automatically put the
 COMSPEC environment variable in the environment for you.

                              Robert Clark


 The word on my block is that the second parameter is simply wasted
 typing (read: redundant), UNLESS the CP is not in the root (as it is
 above). Accordingly my shell line has never included it, yet when I
 enter SET at DOS, I always see as the first environment variable, the
 COMSPEC line. Could this be a MUF? Just a hold over from some earlier
 versions of DOS? I am using 6.2, but cannot remember using that second
 parameter, since the word went around  {^; (I may have read that from
 either Dan Gookin or DOS Power Tools).

                              Bat Lang


 It was introduced with DOS 4, which needed SHARE to support
 large media (40meg HD). If SHARE wasn't loaded in config.sys,
 DOS used the second parameter to find SHARE.EXE, not COMMAND.COM.

 If command.com is in the root, you don't even need a shell or explicit
 comspec statement.

                              Rob Flor



NO COMMAND.COM IN ROOT DIRECTORY

 MS-DOS doesn't use a specific location any more (for system
 files). You can move'm around all you want. At least since
 DOS 5.

 Dos 5+ system files aren't position sensitive. Just replace
 dos 5 with dos 6 including command.com and system files,
 then reboot the machine.

 Try it yourself. Format a floppy with dos 5, copy new
 system/command.com to it, and reboot.

                              Rob Flor


 In the absence of a SHELL statement, MS-DOS v6.x looks for the CP
 (command processor) first in the \DOS directory, then in the root,
 then in \MSDOS. The COMSPEC evar will then be set to wherever the
 CP was found.

                              Robert Clark


 The three subdirectories, "\", "\DOS", and "\MSDOS" can be seen
 inside DOS's hidden "IO.SYS" file and, DOS automatically sets the
 COMSPEC environment variable to point to the location of the
 COMMAND.COM it booted with.

                              Vernon Frazee


 Is this search pattern documented anywhere that you have seen?

                              Gary Cooper


 Not officially, at least not that I'm aware of. Someone over in
 the RIME DOS conference mentioned this over a year ago, and a
 little experimentation at the office showed that the search
 pattern worked as advertised.

 I'm just showing my (operating system) age. In the absence of
 a SHELL statement, MS-DOS v6.x looks for the CP (command
 processor) first in the \DOS directory, then in the root, then
 in \MSDOS. The COMSPEC evar will then be set to wherever the CP
 was found.

 Previous versions would choke and die horribly if the CP weren't
 in the root and there was no SHELL directive. Also, the COMSPEC
 would only be created if the second parameter in the statement
 SHELL=\foo\path\foo.bar \foo\path\... was present.
                         ^^^^^^^^^^
 In the absence of a SHELL statement, MS-DOS v6.x looks for the
 CP first in the \DOS directory, then in the root, then in
 \MSDOS. The COMSPEC evar will then be set to wherever the CP
 was found.

                              Robert Clark


 DR-DOS 6 doesn't care where it's corresponding files (IBMBIOS.COM,
 IBMDOS.COM) are physically located, so long as they are in the root
 directory. In fact, I have sometimes run ATTRIB -RH on them so that
 a HD defrag program would move them.

                              Tom Schluter


 The same is true of MS-DOS, versions 5.0 and later.

                              Gary Smith


 Yes, happens here too (DOS 5.00). Even more annoying is that the
 expen$ive Norton Utilities will get fooled too. You can't "Make a
 diskette bootable" unless COMMAND.COM is on the root of C:\
 regardless of the value of COMSPEC.

                              Gerry Pareja

 ? ... working here:

   a) Running MSDOS v5.00 revA
   b) SHELL=C:\DOS\COMMAND.COM
   c) COMSPEC=C:\DOS\COMMAND.COM
   d) and _no_ COMMAND.COM in the root dir

   A subsequent:

   FORMAT A: /Q /U /S /V:"" /F:1.2

   command produces a bootable 1.2meg floppy
   (with IO.SYS, MSDOS.SYS, and COMMAND.COM).

                              Vernon Frazee


 Yes the above works, what doesn't work is:

   SYS C: A:

 You get the message "Could not copy COMMAND.COM onto target disk",
 you can of course copy COMMAND.COM to the target disk manually.

 The same is true in Dos 6.00 and 6.20, except DBLSPACE.BIN also
 gets copied over as a system file.

 So FORMAT is able to use comspec to find COMMAND.COM, but the SYS
 command is not.

                              Terry Kreft


 The only problem seems to me that doing SYS A: will come up with the
 message "Could not copy COMMAND.COM onto target disk" (and what you
 have to do then is obvious).

                              John Gray


 My SHELL command has always pointed to my MSDOS directory, but
 I've always had a copy of COMMAND.COM in the root (I think
 INSTALL puts it there). I've just deleted it on two machines
 (one with 6.00 German and one with 6.20 English) and, sure
 enough, the SYS command couldn't find it on either machine.

 Up until now I've always believed my big thick DOS 6.00 bible,
 which clearly states that the SYS command will search for
 COMMAND.COM in the path specified by the COMSPEC variable...

                              John Evans


 I'm using NDOS and I don't have COMMAND.COM (or NDOS.COM for that
 matter) in the root directory and I just formatted a diskette to
 be bootable using SFORMAT.

                              Scott Paterson


   C:\dir a: /a                              +- Now what's on A:
                                             |
   Volume in drive A has no label            |
   Volume Serial Number is 4029-12F7         |
   Directory of A:\                          |
                                             |
   DBLSPACE BIN    64,246 09-30-93   6:20a   +- No COMMAND.COM!
   IO       SYS    40,566 09-30-93   6:20a   |  Also I don't have
   MSDOS    SYS    38,138 09-30-93   6:20a   |  DBLSPACE.BIN in my
   3 file(s)       142,950 bytes             |  root. So it managed
                 1,313,792 bytes free        |  to find that.
                                             |
   C:\                                       +- Done

 Note this is with MSDos 6.20!

 Wonder why SYS doesn't work "properly" (i.e. doesn't use COMSPEC
 to find COMMAND.COM) if they fixed it for the version your using
 on that set-up.

 Aha, I got my MSDos 5.00 disk working and SYSed my HD to 5.00,
 deleted COMMAND.COM from root and SYSed a floppy (using MSDos
 5.00 SYS.COM) and it copied COMMAND.COM over, so for some reason
 they've taken the facility (to use COMSPEC to find COMMAND.COM)
 out!

                              Terry Kreft

===============================================================================
7) COPY

 Using:

   COPY <wildcard specifier> <explicit filename>

 is the same thing as:

   FOR %%1 IN (<wildcard specifier>) DO COPY <exp. filename>+%%1 <exp. filename>

 such as:

   COPY *.TXT ALLTEXT.DOC

 is the same as:

   FOR %%1 IN <*.TXT> DO COPY ALLTEXT.DOC+%%1 ALLTEXT.DOC

 I used this one to combine all the MUF files to one file by saying

   copy *.txt muftext.doc

 any wildcard specs and exp. filename will work just fine...

                              Mike Anderson

 Try:

   COPY  FIRST+SECOND  FIRST

 Whatever happens, it is a DOS requirement that you have to create
 a completely new file, with both sets of records in it -- this is
 just how ordinary DOS files work, I'm afraid, so you're stuck
 with it.

                              John Gray

 Unless you do this one:

   TYPE SECOND >> FIRST

 However, if FIRST has an EOF mark, it will probably not be removed
 with old M$-DOS versions (my M$-DOS 5.0 works fine though).

                              Horst Schaeffer


 Well, would you believe it! You seem to have found an exception to
 my 'rule'! Well done...

                              John Gray

 You can do:

   COPY FIRST+SECOND

 with the same results. (The SECOND file concatenates to the
 FIRST).

                              Vernon Frazee


 This is true -- yet another undocumented feature?

                              John Gray


 Command.Com won't copy a zero-length file; 4DOS will - thus breaking
 all those bat files which use this "feature".

                              Mitch Ames


 Actually, I thought this was a problem in some of the newer (5.0+?)
 versions of DOS.

                              Scott Wunsch


 I believe this "feature" has been around since at least v3.30, and it
 is documented in v5.0 (p391 of the manual).

 I just checked and v3.30 of command.com can't copy 0 length files
 either, but it is _not_ documented in the 3.30 (MS-DOS) manual.

                              Mitch Ames



(EDITOR'S NOTE: See the DIR and DELIMITING CHARACTERS sections as well
for additional information on the use of . , .. \ etc. as below)
I acknowledge that some of the information presented in these sections
may be documented, although obscure features. The reason that this
information continues to be seen in the MUF list is because I believe
that the ability to use the period immediately after the copy command
IE: COPY. is not documented. What is documented is the fact that "."
and ".." can be used to represent the current and parent directories
respectively, and these will work with many applications which can
handle directory names as arguments. In this case the "." could also
be viewed as a replacement for "*.*"


COPY. A:

 The use of a decimal point IMMEDIATELY after some DOS statements,
 will replace *.*

 EXAMPLES: DEL.     (erase all files in current directory)
           COPY. A: (copy all files in current directory to A:)

 There may be more statements with which it works, but I haven't
 tried them yet.

                              Willem van den Broek


 "." means the current directory, and Command.com will assume that
 \directory implies \directory\*.* for most commands where a
 filename(s) should be specified, eg:

 DIR \ is the same as DIR \*.*
 COPY \FRED is the same as COPY \FRED\*.*
 COPY. A:\ is the same as COPY .\*.* A:\ which is the same as COPY *.* A:\
 DEL. is the same as DEL .\*.* which is the same as DEL *.*

                              Mitch Ames

===============================================================================
8) CTTY

EDITOR'S NOTE:

The following section consists of extracts from messages which have
answered the question: "How do I stop the program output (during the
loading of CONFIG.SYS) from being echo'd to my screen". Many have
suggested that users redirect the output to the NUL device, however,
this technique has been found to cause errors when the program being
loaded is a TSR (Terminate and Stay Resident). The errors are due
to the fact that the TSR does not release the file handle which is
used in the redirection process.


 The reason I started using ctty was because of a message in a
 echo which I now forget, maybe debug. Some guy was having a
 problem to which he got the response that too many program >
 nul used up "handles".

                              Dan Dunfee


 There's a thread going on here now about redirection not releasing
 file handles when you re-direct output from a TSR. I don't think
 its a problem otherwise, didn't know it was a problem with TSR's.

                              Jack Stein


 FYI, the same thing happens (trapped file handles) when you CTTY>NUL
 and load a TSR.

                              Gary Cooper


 That would be the heading in my DOS manual (CTTY) where I
 would "expect" to find warnings about redirecting TSRs...
 but mine doesn't even acknowledge that "nul" _is_ a valid value
 for CTTY (although I've been using it to hide stuff since 2.0,
 and my 670 page manual _does_ list "prn, lpt1-3, con, aux, and
 com1-4" as valid devices to ctty to.)

 AH HA! Now it *is* a MUF!

 "CTTY NUL" is *UN*documented and WILL WASTE a file handle if used
 in conjunction with loading a TSR. The same will happen if you
 "redirect" a TSR to nul.

                              Don Hoffman


 In the FWIW department I had to test/verify the CTTY thing for
 myself (just now,) and I found something slightly interesting in
 that the 'releaser' pgm:

 FILES - (c) 1993 Holger Daehre 2:248/317.88

 which BERND HOHMANN kindly posted here was _not_ able to recover
 all the handles I trashed via: .bat file:

   ctty nul
   fmark %tmp%test.mrk
   eatmem 1
   eatmem 1
   eatmem 1
   eatmem 1
   ctty con

 It initially showed 2 handles lost and unrecoverable; When
 I RELEASEd /K(ept mark) it still showed 2 gone/unrecoverable...
 but after a second RELEASE (of test.mrk too) it reported 1 file
 handle reclaimed, and one still lost.

 A second run w/ the EATMEMs commented-out lost me another
 handle which couldn't be recovered regardless of RELEASEs done.

 (I even released all the way back to my '00' mark, which kills
 everything except my command processor... 2 extra handles still
 reported as in-use / unrecoverable):

 Number of used handles before cleaning : 006
 Number of used handles after  cleaning : 006

 (should be 4 at this point, including the redirection for capture,
 but note I do _not_ have any alternate technique to verify /
 crosscheck these numbers with!)

 I expect 'your milage may vary'... maybe something about
 my (ancient 8088 semi-compat) hardware, and/or software platform
 (IBM 2.0.11 + MS 5.0 + 4DOS)... or maybe even pgm bug. (Those
 results don't make a lot of sense to me... but it's hardly
 something I should be doing in the first place ;-))

                              Don Hoffman


EDITOR'S NOTE:

 In response to a question asking why:

   MD C:TEMP > NUL

 did not work as expected...


 If C:\TEMP already exists, MS-DOS 6.2 will STILL REPORT that fact,
 even with the " > NUL" output redirect. If the original poster
 needed a completely silent process, this won't quite do it.

                              Steve Burton


 True, however CTTY NUL before the md command, and CTTY CON after
 still works, eg:

   ctty nul
   md c:\temp
   copy a:\*.* c:\temp
   ctty con

 Unfortunately, CTTY >NUL no longer works, at least in Dos 6.2

                              Dale Woloshin

===============================================================================
9) DELIMITING CHARACTERS

 Prior to DOS 5.0, there was an undocumented DOS function that
 would allow you to set the DOS option delimiting character to
 something else, like -. Once you did this, you could use either
 \ *or* / in PATH specs.

 DOS 5.0 removed the function to *set* the option delimiter, but
 *retained* the one to query what it currently is! (Don't ask me,
 ask M'Soft...)  Fortunately, the MKS Toolkit still works with no
 apparent glitches.

 I believe in pre-DOS 3.X versions that there was a parm you could
 provide in CONFIG.SYS to do this, but have no further details.

 Just remember: "undocumented" is a synonym for "unsupported, and
 not guaranteed to be there next release", which is what happened
 in the case I mentioned above.

                              Dennis Mccunney


 Another good thing is you can travel from directories to
 directories without typing "CD". Just type the directory name
 followed by a backslash '\'.

 Example: To go from C:\BATCH to C:\WP51, you type "\wp51\".
 That's it! fast and easy.

                              Marc Y. Paulin


 This is a 4DOS/NDOS feature; it is not available under COMMAND.COM.

                              Scott Wunsch


 If you are in the following directory :

   \WORD\FILES\LETTERS\APRIL

 And wanted to go to the directory \WORD\FILES, you'd normally 
 type two lines : 

   CD \
   CD WORD\FILES

 Or even the single line "CD \WORD\FILES" to combine the two 
 commands into one. There is a shorter way, simply type the 
 following : CD ..\..  You're there!

                              Andrew Barnhardt


 I just found out that using the command

   DELTREE .

 cause the deletion of all directories with verification,
 ie 'do you want to delete the directory somedir and all
 subdirectories and files?'. If you've got 6 directories
 in the directory your in you get prompted for each one.

                              Kirt Thomas


 While the on-line help does not specifically mention using the
 dot "." character, it does have a section stating that you can
 use wildcards. I consider the dot to be a wildcard.

 It says that if you use a wildcard, any matching files and
 directories will be deleted.

                              Michael Clays


EDITOR'S NOTE:  For additional information regarding the use of
"." as a wildcard see the DIR section.


 Have you tried the subject line? i.e. DELTREE /Y C:\TEMP\
 (note the trailing backslash)

 With MSDOS 6.22 it will delete all files in, and all subdirectories
 below, but will NOT delete \TEMP itself!

                              Michael Marquart


 I get two empty directories in each directory, too. (called"." and
 "..") Maybe because mine are 4096-bytes?

                              Bob Browar


 Every directory you create off of the root directory will contain a
 "." (single dot) and a ".." (double dots).

 The single-dot is an abbreviation for the current directory and
 the double-dot is an abbreviation for the next directory up (parent)

 The single-dot is really pretty useless as far as when using it with
 one of the directory commands: MD (make directory), CD (change
 directory), or RD (remove directory). But, it can be used to do
 something like:

 a) Copy everything in your current directory to A:\

    copy . a:\

 b) Create a zero-length file:

    cd.>x

    (file "x" will be a zero-byte file)

 d) Even handier but possibly disastrous, the following command
    will not only delete all the directories of, but of all the
    files (even the ones with the Hidden, System, and Read-Only
    attributes assigned) in and below, your current directory:

    deltree /y .

    For example, if you had the directory structure:

    A:.
    \---TEST
       +---1
       +---2
       +---3
       +---4
       \---5

 had files (even hidden) in any or all of the directories, and
 you were in the root directory of drive A:, the command:

    deltree /y .

 would delete _everything_ below the "." (current) directory.

 The double-dot ("..") directory entry comes in handy when you want
 to change to a sister directory. For example, take the same
 directory structure:

    A:.
    \---TEST
       +---1
       +---2
       +---3
       +---4
       \---5

 Then let's say you're in directory "A:\TEST\3" and want to change to
 "A:\TEST\5". Instead of typing:

    cd\test
    cd 5

 or:

    cd\test\5

 you could just type:

    cd ..\5

 (Remember, the ".." stands for the next directory up (the parent)).

 Let's say you were in "A:\TEST" and wanted to copy everything in it
 to the root directory:

    copy . ..

 (In other words, copy "current-directory" to "parent-directory").

 If you wanted to copy everything from the root to where you were:

    copy ..

 This is but a _small_ example of how the single- and double-dot
 directory entries can come in handy with a variety of commands.

                              Vernon Frazee

===============================================================================
10) DEVICEHIGH

 This line in CONFIG.SYS will, according to MS-DOS 6.22 help,
 prompt the user about loading the device with the classic [Y,N]

   DEVICEHIGH? /L:1,9072 =C:\DOS\ANSI.SYS

 And so it did for me until I ventured into multiconfig to
 accommodate some EMS demanding proggies.

 It appears that once the [MENU] is added to CONFIG.SYS this is
 no longer an option. Not a major hassle, as a submenu can be
 used as a work around, but I was unable to locate any mention
 of this drawback in the HELP.

                              Peter Lovell

===============================================================================
11) DIR

DIR (, . ...)

DIR,

 Using a comma IMMEDIATELY after DIR, shows ALL files, including
 the HIDDEN ones.

   EXAMPLE: DIR,

                              Willem van den Broek


EDITOR'S NOTE: As you will read below, there are mixed reports as
to whether this MUF will work the same with all versions of DOS.
Warning: Your "mileage may vary". Much of what is reported in this
section might also have been covered in the Delimiting Characters
section.


 Just tried it here, booting off of an original MS-DOS 3.30
 diskette, and what Mr. Broek stated is true.

                              Vernon Frazee


 Going back as far as DOS 3.3, it is possible to find hidden
 files, and hidden directories for that matter by using the
 following:
 
   DIR,

 It seems a bit easier than testing for attributes. It simply
 show all files in the required directory

                              Greg Miskelly


 This appears only to work with version 5. I tried it with 3.30,
 and it didn't display either IO.SYS, MSDOS.SYS (both with S, H
 and R attribs) or a test file with A and H attribs.

 With version 5 it displayed the test file with H and A, but would
 not display IO.SYS or MSDOS.SYS with S, H and R. This doesn't
 surprise me actually, since S alone (without H) will prevent
 inclusion of a file in a normal DIR.

 I didn't try version 4.

                              Mitch Ames


 I can confirm that the DIR, does NOT work with MS-DOS 3.2, 3.3,
 and 4.01, nor with Compaq DOS 3.31, DR-DOS 6.0, or Novell DOS 7.

 Works here with MS-DOS 5.0, MS-DOS 6.0, and MS-DOS 6.22.

                              Ron Warder


 It also works as DIR ,  (with an intervening blank).

                              John Gray


   MS-DOS Version 5.00
   C:\ >dir ,

      Volume in drive C has no label
      Volume Serial Number is 1221-0000
      Directory of C:\

      IO.SYS
      MSDOS.SYS
      [BATCH]
      * * *
      WINA20.386
            36 file(s)     508790 bytes
                         35735552 bytes free

      MS-DOS Version 5.00
      C:\ >attrib io.sys
      SH      C:\IO.SYS

 As you can see, this system's using MS-DOS 5.0, IO.SYS is
 System and Hidden, and "Dir ," displayed both it and MSDOS.SYS.

                              Bruce Wilson


 It works here with PC-DOS 6.1

                              Rodney Foremski


 I dug out my old disks and rebooted to try each version with the
 following results:

 MS-DOS Version 3.21                      12-03-87    3:21a

 IBM Personal Computer DOS Version 3.30    3-17-87   12:00p

 dir,  - does not show hidden files in either version,
       - the original manual I received with V3.21 only
         lists the +/- A and +/- R options for the ATTRIB
         command, no mention of the ability to set or
         modify the System or Hidden attributes.
       - any attempt to set or unset the System or Hidden
         attributes on a file using ATTRIB under these DOS
         versions results in a "Syntax error" message.

 MS-DOS Version 5.00                     04-09-91     5:00a

 dir,  - displays all files in the current directory regardless
         of attributes set (Archive,System,Hidden,Read only)
       - online help and manuals fully document the ATTRIB
         command's ability to set/unset all attributes.

 Those are the only DOS versions I have handy, hope this helps.

                              Pete Smith


 Interesting: it (DIR,) does for me (display DOS5 IO.SYS and MSDOS.SYS):
 However, 4DOS does not do it:

                              Dennis Mccunney


 It was pointed out in the 4DOS echo, and there were people
 who said it didn't work for them. But, on my machine running
 straight dos6, it works! DIR, (dir comma) in my C:\ shows all
 files including hidden and system.

                              Bill George



EDITOR'S NOTE: In response to the following comment:


 If you include the /b switch, you'll get the complete
 pathname for each file. Also if you use the forward slash
 you'll get all the dll files on the current drive.

   dir/s/b \*.dll|sort>dll.txt

                              Jeff Martin


EDITOR'S NOTE: Jeff receive the response:


 You will, UNLESS you happen to HIDE a directory or two (or three)!
 This command will NOT report ANY files that are inside a hidden
 directory tree.

 I played with this a bit, but didn't find a way to include hidden
 dirs and/or hidden files with a "simple" command.

                              Gary Smith


 There is an undocumented variation.

   dir,

 that will include system and hidden directories/files. The comma
 needs to be right after the r.

                              Roger Scudder


 No, actually it doesn't...try "DIR    ,"  or even "DIR/P   ," and
 it still works, *but* you canNOT (as far as I can tell) use the
 "comma MUF" when you SPECIFY a target, ie the *.DLL in the original
 example.

   dir/s/b \*.dll|sort>dll.txt

                              Greg Smith


DIR..

 With DOS 6.0 you can get a directory of -all- files (hidden,
 system, etc.) with this command.

 It was in a PC/Mag. or PC/Comp. issue not too long ago.

                              Andrew Barnhardt

DIR...

 Have you noticed also how DIR ... only displays directories, not
 files?

                              Gary Marden


 That's pretty slick. I tried DIR.. and got the parent 
 directory. DIR... got the current directory subdirs only.

                              Bill George


 Works for any level of directories. ".." will go to the previous
 directory as with pure DOS, "..." will go to the directory before
 the previous and so on.

                              Ng Cheng Kiang


 In DOS 5.0, it displays files and directories which have no extension.

                              Larry Kessler


 Here's another gem discovered here for DIR, try DIR...
 shows only subdirs.

                              Richard Gray


 In DOS 5.0 it displays directories and files with no extensions.
 I tried "DIR ...", "DIR...", and "DIR ....". They all behave
 the same way.

                              Gary Smith


 With DOS 5.0 and NDOS 6.0, DIR... gives me a list of
 subdirectories off of the root and a list of all files in
 the root directory, regardless of the file extension. It
 will yield this result regardless of what directory or
 subdirectory I am in at the time the command is issued.

                              Gary Cooper


 This is, I believe, a result of another little feature (MUF?),
 that allows DIR to accept an extension like this: "DIR .BAT".
 This would act like "DIR *.BAT". Because DOS automatically
 trims off useless characters, it trims the "..." down to a ".",
 but doesn't process it as meaning the current directory because
 it is already past that part of its processing.

 This is because 4DOS/NDOS can handle ... as the "parent of
 the parent directory". So if you were more than three
 directories deep, then DIR... would no longer give you the
 root.

                              Scott Wunsch


 COMMAND.COM generally seems to ignore excess characters. Try
 copying something the AIRPLANES.PLAN, for example, and see what
 happens.

                              Gary Smith


 While I was playing around with "dir ..." and trying to see
 how it parses to showing all extensionless entities in the
 current directory, I noticed that DIR doesn't care if a
 specified directory structure exists or not, as long as the
 overall structure points back to something that does exist, i.e.

   dir \thisdirdoesnotexist\..

 will ignore the garbage and show the root directory. If
 c:\bat exists, then

   dir c:\bat\thisdirdoesnotexist\nordoesthisone\..\..

 will show the c:\bat directory.

 Again, absolutely useless as far as i can tell <g>, but
 interesting.

 BTW, has anybody solved the "dir ..." mystery yet? I also
 noticed "dir \..." works while "dir \bat\..." fails (any
 explicitly specified directory other than the root generates
 an "invalid directory" message).

                              Paul Leonard


 Regarding the 'point' notation/wildcarding, the situation
 is that "point-notation" is recognized at the INTERRUPT-level
 by some DOSs/some interrupts. It is *not* a MUF in the sense
 (A) that it *is* documented in any comprehensive Int Reference
 Manual; (B) it is *not* specifically "available" to/from certain
 DOS (etc) commands, it is rather "passed-on" without syntaxing
 (maybe) to the BIOS-level functions, which may or may-not
 recognize it, dependant on what OEM and HARDWARE you have, and
 is relatively *IN*dependant of whatever DOS you are currently
 running.

 In Other Words: it's a documented Freebe/Maybe --- at the
 BIOS/INTERRUPT level!

 nb. Anywhere single-dot notation (current directory) is
 accepted/works, so will double-dot '..'  (and maybe triple-dot,
 etc!!) This is a _very_ good way to accidentally *trash* your
 ROOT directory!!

   '..' => "parent of current directory"
   '...'=> "parent of parent of current directory", etc; although
           in some implementations a '\' may be needed following
           the last '.'

 I think the CD question ("CD\" as opposed to the documented
 "CD \") is in the same category: it is not-even an MS
 *Function* per se, but is rather 'recognizable' by the BIOS
 functions which the Command-Parser relies upon.

                              Don Hoffman


DIR *.

 To be exact: this (DIR...) shows all files and directories without
 extension, just like DIR *.

 (tested under MS-DOS 5.0)

                              Horst Schaeffer


 You are right! I am surprised.

   DIR *. will list directories, but no files!

                              Per Kristensen


 This one doesn't only show subdirs, it also shows files
 without extension.

                              Rene Verhagen


 If the directory is empty, the above will fail.

                              Vernon Frazee

===============================================================================
12) DRIVPARM

DRIVPARM /c

 Syntax: DRIVPARM /d:number [/c] [/f:factor] [/h:heads] [/i] [/n]
         [/s:sectors] [/t:tracks]

 /d:n   refers to the drive NUMBER (0=A:, 1=B:, 2=C:, etc...) of the drive
        whose parameters you are changing (in your case, it would be 2 for
        B:).

 /c     is the switch I was referring to for change line support. IF YOU
        INCLUDE /c, YOU ARE TELLING DOS THAT YOUR COMPUTER *CAN* TELL
        WHETHER THE DRIVE DOOR HAS BEEN OPENED SINCE THE LAST ACCESS.

 /i     specifies an electronically-compatible 3.5 inch floppy disk-drive.
        You should use it if your computer's ROM BIOS does NOT support 3.5
        floppy diskette drives.

 /n     specifies a NON-removable block device

 The other parms are similar to DRIVER.SYS

                              IBM Technical Publication Information
                              forwarded by Andrew Barnhardt


 The '/C' switch doesn't actually check to see if the drive -door-
 has been opened or not, but it does make another check to see if
 the disk in there now is different from the one when the drive was
 last accessed. I have to use that switch with my 5 1/4 floppy
 because it's an older drive working with a new motherboard (at
 least that's the explanation I've heard).

                              Andrew Barnhardt


 Does DRIVPARM return an errorlevel, or give a warning message?

                              Gary Cooper


 No, not that I'm aware of. You insert the drivparm command in
 your CONFIG.SYS file. Just DRIVPARM=xx xx ...

                              Andrew Barnhardt

===============================================================================
13) ECHO

ECHO OFF   from the command line erases the prompt and leaves
           just a cursor on the screen.

ECHO ON    from the command line restores the prompt.
 
 This works with all version of DOS (tested so far!).

                              Michael Larsson


EDITOR'S NOTE: One of the most frequently asked questions in
the BatPower echo is "How do I ECHO a blank line?"  The most common
answer is "ECHO."  However, I have captured a few posts which
expand on the possible answers to this request:


 ECHO"

                              Paul Welsh


 just about any white space character will work.

                              Alan Newbery


 I just found out myself that any delimiter will work here
 (ECHO. ECHO" ECHO, ECHO: ECHO; ECHO[ ECHO] etc.). Apparently
 it's just the way that the command handles the delimiter and
 has been available from way back. Microsoft just began
 mentioning it in the documentation recently, though, and their
 examples use a period.

                              John Whitfield


 Different sets of delimiters work in different versions of DOS.
 Finding one that works in all versions can be tricky, but if I
 recall correctly, the period works most of the time.

                              Gary Smith


 Can anyone tell me how to write

    OFF

 on the screen - with no preceding spaces, no quotation-marks etc.
 from a batchfile - and preferable with the ECHO-command?

                              Karsten Weldingh

 Simple, try:

   ECHO.OFF

 Works fine under DOS 6.0!

                              Michael Larsson / Matthew Lewis


 DOS 5.0, too - where did you find this tidbit? I just tried it with
 the usual suspects and they work, as well (echo[off, echo]off, etc.).

                              Paul Leonard


EDITOR'S NOTE: Regarding the commonly used technique of using:

   ECHO.|TIME

to feed a carriage return / line feed to the MS-DOS TIME command,
and avoid the necessity of pressing ENTER in response to the TIME
commands' prompt to enter a new time, I captured the following
discussion:


 Just a note, the command:

   VER|TIME

 will prove to be a bit faster.

 Since both are internal commands the elapsed time
 required for each to execute should prove to be almost
 identical. We quit using the "echo." about a year or so
 ago when because of a blurb in PC World (or was it PC
 Magazine) that said it would reset the time to 00:00 on
 one of the popular brands of network software.

                              Vernon Frazee


 "echo. |time" is faster yet, and is abusive of neither DOS nor
 the user.

 That would qualify as a bug. I don't think much of introducing
 buggy "work arounds" for something that NEEDS to be fixed.
 ("VER|TIME" will hardlock some CLI's, depending on the format
 VER is presented in... neat: crash a time-check because of an
 unusual VER format.)

                              Don Hoffman


 What brand of network software, what CLI's?

                              Gary Cooper


 I do know from personal experience that VER | TIME _will_
 hardlock some non-MS's however... 4DOS 4.0 rev B for-sure.

                              Don Hoffman


   echo "echo y|del *.* > wipe.bat" > test.bat

 will create the file test.bat but it contains the line

   "echo y|del *.* > wipe.bat"

 which of course will not execute. All you have to do is find a way
 to delete the double quotes, an intellectual exercise :-) If you
 find an answer I would appreciate knowing as well.

                               Amer Neely


 You can use EDLIN to strip the quotation marks out of TEST.BAT
 with:

   C:\DOS\EDLIN TEST.BAT < TEST.SCR

 Where TEST.SCR contains the following:

    1,#r"^Z
    e

 You will have to create TEST.SCR with an editor which permits you
 to put a ^Z directly into the document. This is NOT a caret and
 an upper case "Z", with EDLIN it is F6 or ASCII-26 the end of file
 marker. For example, in MS-DOS EDIT you can place the ASCII-26
 character (a small right pointing arrow) in a document by pressing
 CTRL-P and then CTRL-Z.

                              Gary Cooper


 To eliminate the leading double-quote you can do a:

   echo"echo y|del *.*>wipe.bat ">doit.bat

 (Note how the two echo's are separated by a single double-quote
 mark with no space). When the above is executed, DOIT.BAT will
 contain:

   echo y|del *.*>wipe.bat "

 In this particular instance the trailing double-quote mark doesn't
 really matter (because it is separated by a space from the file
 extension). But, if it really bothers you, it can be eliminated
 using EDLIN _without_ worrying about a ^Z ([Ctrl-Z]). Try this:

   @echo off
   echo"echo y|del *.*>wipe.bat ">doit.bat
   for %%x in (echo type) do %%x DOIT.BAT
   echo 1,1r">temptemp.scr
   echo e>>temptemp.scr
   echo.
   echo EDLIN at work:
   edlin doit.bat<temptemp.scr
   echo.
   for %%x in (doit.bak temptemp.scr) do del %%x
   for %%x in (echo type del) do %%x DOIT.BAT

 Hint: The only time you need a [Ctrl-Z] with an EDLIN "R" (replace)
 command is to separate the character(s) being replaced from
 the character(s) they are being replaced with.

                              Vernon Frazee

===============================================================================
14) EDLIN

 where an EDLIN script is:

  -1,#r 1:^Z  1:
  -1,#r 2:^Z  2:
  -1,#r 3:^Z  3:
  -1,#r 4:^Z  4:
  -1,#r 5:^Z  5:
  -1,#r 6:^Z  6:
  -1,#r 7:^Z  7:
  -1,#r 8:^Z  8:
  -1,#r 9:^Z  9:
   e

 Note the spaces (one after R, two after ^Z) which prevent replacement
 of the second digit in a two digit number.

 This will update the last line only, so needs to be done at each
 boot. '#' means last line +1. '-1' means the line before the current
 one (ie: the last line of the file, if "#" is the current line). Note
 that you can only use '-1' in later versions (it works in 5, but not
 in 3.30 as far as I know).

                              Mitch Ames


 In Edlin 3.30 and 5.0 you can use the following as line numbers:

    .   current line
   -n   n lines back from the current line
   +n   n lines forward from the current line
    #   end of the file

 '.'   and '#' were documented in 3.30, but aren't in 5. -n and +n are
 not documented in either.

                              Mitch Ames


 Your 3.3 manual is obviously different than mine. All of the above
 are documented in "Microsoft MS-DOS User's Guide and User's Reference"
 which was published by Microsoft Corporation, 16011 NE 36th Way,
 Redmond, WA 98073-9717 in 1987.

 Edlin is covered on pages 161 to 193.

                              John Evans


Correction:

 John Evans pointed out that -n and +n _are_ documented in v 3.30
 (under "tips for using Edlin"). There is also a single reference to
 +n in the 5.0 manual under the Move command (line1,+n,line3 M), but
 it does not say that you can use +n anywhere else.

 So I guess the MUF should read:

 In Edlin 3.30 and 5.0 you can use the following as line numbers:

    .   current line
   -n   n lines back from the current line
   +n   n lines forward from the current line
    #   end of the file (_after_ the last line)

 These are documented in 3.30, but not explicitly in 5, although there
 is a reference to +n under the Move command (line1,+n,line3 M).

 This can be useful for scripts, eg to delete the last n lines of a
 file:

    #
   -n,.d
    e

 To delete all except the last n lines

    #
    1,-Md     ;where M is n+1, since # is _after_ the last line
    e

 To delete all except the first n lines

    n
             ;CR (or ^C) to terminate editing of line
    +1,#d
    e

                              Mitch Ames

===============================================================================
15) FDISK

FDISK /STATUS ?

 Prints a screen just like using option 4 of fdisk "Partition
 information", but includes extended partition information.
 Nice if you want to get an overview without fear of pressing
 the wrong keys.
                              Armin Hanisch


 Doesn't work in Ver 3.30.

                              Mitch Ames


FDISK /MBR

 MS-DOS 5.0 FDISK has an undocumented parameter, /MBR, that causes it
 to write the master boot record to the hard disk without altering the
 partition table information. While this feature is not documented, it
 can be told to customers on a need-to-know basis.

 What is the MBR?
 
 At the end of the ROM BIOS bootstrap routine, the BIOS will read and
 execute the first physical sector of the first floppy or hard drive on
 the system. This first sector of the hard disk is called the master
 boot record, or sometimes the partition table or master boot block. At
 the beginning of this sector of the hard disk is a small program. At
 the end of this sector is where the partition information, or
 partition table, is stored. This program uses the partition
 information to determine which partition is bootable (usually the
 first primary DOS partition) and attempts to boot from it.

 This program is what is written to the disk by FDISK /MBR and is
 usually called the master boot record. During normal operation,
 FDISK only writes this program to the disk if there is no master
 boot record.

 Why is the MBR changed during Setup?

 During installation of Microsoft MS-DOS 5 Upgrade, Setup will replace
 the master boot record on the hard disk with code to display the
 message:

   The MS-DOS 5.0 Setup was not completed.
   Insert the UNINSTALL #1 diskette in drive A.
   Press the ENTER key to continue.

 This message should be erased and the master boot code rewritten
 before Setup is completed. If a problem occurs during Setup and you
 return to the previous MS-DOS, UNINSTAL should also remove this
 message. However, should Setup or UNINSTAL fail to remove this
 message, or should the master boot record become corrupted, a new
 master boot record can be written to the disk using the following
 command:

   C:\>fdisk /mbr

 Warning: Writing the master boot record to the hard disk in this
 manner can make certain hard disks unusable. IE: those partitioned
 with SpeedStor, or Microhouse's DrivePro program. It can also cause
 problems for some dual-boot programs, or for disks with more than 4
 partitions. Specific information is below.

 WARNINGS:

 This option should not be used if:

   - the disk was partitioned using Storage Dimensions' SpeedStor
     utility with its /Bootall option
   - the disk was partitioned using MicroHouse's DrivePro program AND
     the drive was NOT setup using a standard CMOS value.
   - more than 4 partitions exist
   - certain dual-boot programs are in use

 Storage Dimensions' SpeedStor utility using the /Bootall option
 redefines the drive's physical parameters (cylinder, head, sector).
 /BOOTALL stores information on how the drive has been changed in an
 area of the master boot record that MS-DOS does not use. FDISK /MBR
 will erase that information, making the disk unusable.

 MicroHouse's DrivePro program functions similarly to SpeedStor above, 
 and has the same boot record vulnerability. MicroHouse identifies their
 boot program at boot-up by a small MICROHOUSE logo near the left side of
 the screen about two-thirds down, at power on. If you see this logo, 
 do NOT use FDISK /MBR, or the drive will become unusable.

 Some older OEM versions of MS-DOS and some third-party partitioning
 utilities can create more than 4 partitions. Additional partition
 information is commonly stored information on partitions in an area
 that FDISK /MBR will overwrite.

 Some dual-boot programs have a special MBR that asks the user which
 operating system they want on bootup. FDISK /MBR erases this program.
 Dual-boot systems that boot whichever partition is marked Active are
 not affected by FDISK /MBR.

                              Edited: MicroSoft Publication
                              forwarded by Don Dean
                              editing suggestions made by
                              Matt Mc_Carthy (info re:
                              MicroHouse's DrivePro)


 If you have a Boot Sector Virus, just boot from a known "clean"
 floppy disk (which has the System files and FDISK on it - IE:
 your "disaster recovery disk") and run FDISK /MBR. Bye, Bye Virus!

                              Gary Cooper


 Make sure it's write protected.

                              Jasen Betts


 [Begin quote]

 One of the FDISK functions, updating the Master Boot Record (MBR),
 does not appear on any of the FDISK menus. The Master Boot Record is
 located at the beginning of your primary fixed disk. It is composed of
 two parts -- the master boot code and the partition table. The master
 boot code is a short program that determines which operating system
 will start the computer, then transfers control to that operating system.
 The partition table contains information about the partitions located on
 the fixed disk.

 The Master Boot Record may need to be updated when:

   * An operating system other than MS-DOS is on the fixed disk.
     Some operating systems replace the master boot code with their
     own program, which may not allow MS-DOS to start the system,
     even if the partitions are valid DOS partitions. If this condition
     exists, updating the Master Boot Record will replace only the master
     boot code.

   * The information at the beginning of the fixed disk has been
     overwritten. The partition information is destroyed and the fixed
     disk will no longer start any operating system. If this condition
     exists, updating the Master Boot Record will replace both the master
     boot code and the partition table. However, the partition table will
     not have any defined partitions.

 If you cannot get your system to start MS-DOS from the fixed disk and
 you are sure the initialization process was performed correctly, you
 may need to update the Master Boot Record. To do this, enter the
 following command:

   FDISK /MBR

 FDISK does not display any menus or messages while it is updating the
 Master Boot Record. When the procedure is complete, the MS-DOS
 prompt is displayed.

 If you are unable to start MS-DOS from the fixed disk after updating
 the Master Boot Record, you may need to partition and format your fixed
 disk. If you still cannot use the fixed disk to start MS-DOS, contact
 your Authorized COMPAQ Computer Dealer for further assistance.

 [End quote]
                              Compaq DOS 4.01 Manual
                              Submitted by
                              Paul Maserang


 If the situation at hand involved a trashed partition table. This
 regenerates the partition table, but does NOT restore the user
 partition information in it. Therefore, after using FDISK /MBR, you
 must still use FDISK without the /MBR switch to re-enter the partition
 information before you can do anything else. If the newly entered
 partition information is identical to that which existed there prior
 to the partition table being trashed, and nothing else has been damaged,
 there should be no need to reformat the drive, because the boot sector,
 FATs, directories, and data should still be undisturbed. If the boot
 sector or either of the two hidden system files (IBMBIO.COM/IBMDOS.COM 
 or IO.SYS/MSDOS.SYS) are damaged, the SYS command can be used to restore
 them without losing anything else.

                              Paul Maserang


 I work _only_ with the Microsoft versions, and have not had the
 same experience. The /MBR parameter _only_ rewrites the MBR. It
 does not affect the partition information. I use it daily on
 various machines and have not lost one byte of data.

                              Matt Mc_carthy


 I guess you didn't know that "Master Boot Record" and "Partition
 Table" refer to the same thing. What you're talking about is the
 master boot CODE, the executable code that accompanies the
 partition table and is located on the same physical sector (0).

 Here's what I find in the first few bytes of my physical sector 0
 (unassembled with DEBUG after copying the sector to a file):

   2BB7:0100 33C0        XOR    AX,AX
   2BB7:0102 FA          CLI
   2BB7:0103 BED0        MOV    SS,AX
   2BB7:0105 BC007C      MOV    SP,7C00
   2BB7:0108 BEC0        MOV    ES,AX
   2BB7:010A BED8        MOV    DS,AX
   2BB7:010C FB          STI
   2BB7:010D 8BF4        MOV    SI,SP
   2BB7:010F BF0006      MOV    DI,0600
   2BB7:0112 B90002      MOV    CX,0200
   2BB7:0115 FC          CLD
   2BB7:0116 F3          REPZ
   2BB7:0117 A4          MOVSB
   2BB7:0118 EA1D060000  JMP    0000:061D

 I also find the following text in the first half of the sector:

 Missing operating system. Error loading operating system. Invalid
 partition table. Author - Siegmar Schmidt

 I have only one partition on my C: drive, and its information is
 in the last of four possible positions in the partition table.
 The first significant byte (non-zero) is at offset 01EEh in
 physical sector 0.

 The rest, from offset 00EDh to 01EDh is nothing but 00h.

 So it would appear that everything from offset 0000h to 00ECh is the
 Master Boot CODE, and everything from 00EDh to the end of the sector
 (01FFh) is the Master Boot RECORD (aka partition table). More likely,
 the partition table probably begins at offset 0100h, and takes up the
 last 256 of the 512 bytes available in the sector.

 Beginning with the first significant byte of my partition table (at
 offset 01EEh), this is what mine shows:

   80 01 01 04 03 91 65 11 00 00 00 07 A3 00 00 55 AA
   ^^
 This first byte, I think, is the drive on which this partition
 is located, and the next byte might indicate that this is the
 first (primary) partition (in my case, the ONLY partition for
 this drive).

 Now, according to my manual, FDISK /MBR can either re-write only
 the Master Boot CODE when necessary; or it can re-write both the
 Master Boot Code AND the Master Boot RECORD, if it determines that
 the partition table has been corrupted.

 If it does re-write both, then you do have to use FDISK without
 the /MBR switch after using it with the switch, because the
 re-written partition table has no defined partitions until you do.
 But when you use the /MBR switch, it produces no screen output
 (at least not on the version I'm using), so you don't know whether
 it did both or just the code. So you should still check to see that
 you have a valid partition by using FDISK without the /MBR switch
 afterwards.

                              Paul Maserang

===============================================================================
16) FOR IN DO

FOR %%V IN (/SOMETHING)

LEADING SLASH WITH FOR IN DO LOOP

 In the FOR statement in the INIT and COUNT routines below the
 parameters in the () show a leading "/". This seems to separate
 the first digit of the environmental variable used within the
 brackets (). Am I correct? Is this documented anywhere?

   :================= INIT =================
   set &=%4&|set n$=%4|set m$=%3|set #=%2|set !=%0
   if not '%m$%'=='0' for %%a in (/%m$%z) do if '%%a'=='0' set @=0
   %!%
   :================= COUNT ================
   if '%&%'=='&' goto PROCESS
   for %%a in (/%&%) do set &=%%a

                              Peter Joynson
      

 I have read some articles about this in PC Computing & PC Magazine.
 I don't believe it is documented anywhere but you're right, it strips
 off the first character of whatever string is passed. I will try to
 find one of the articles that explains it better if you need it.

                              Robert Hupf


 Correct. I believe it is not documented (up to DOS 5 anyway) by MS,
 but I have read from other sources that the leading / will split an
 item into the first character and everything else. Eg:

   for %%n in (/hello there) do echo %%n

 will display "h", "ello" and "there". "There" is not split because
 it is a separate item, delimited by the space. If used with an item
 including wildcard (? or *) characters the item will not be expanded
 to the files which match it, thus allowing inclusion of those
 characters in the set. Eg:

   for %%n in (/? /*.bat hello) do echo %%n

 will display "?", "*", ".bat", "hello". This apparently is the
 original reason for the feature, but it may also be used recursively
 to parse a string one character at a time.

                              Mitch Ames


 ... quoting Dirk Treusch to All ...

 How can a batch file (without 4DOS) determine from which drive it has
 been started?

   Example: C:\> a:test.bat

 Now my batch should be able to find out that it is located on drive A:
 (not the path - only drive!).

 Mitch Ames responds:

 The variable %0 contains the name of the batch file
 _as_it_was_typed_at_the_command_line. If you call the batch file as
 A:TEST.BAT, %0 will be "A:TEST.BAT". If you have the directory on
 your path, and simply type TEST, then %0 will be "TEST". The drive,
 path and extension will only appear in %0 if you enter them in the
 command used to call the batch file (either typed at the command
 line, or called from another batch file).

 So you _must_ specify the drive as part of the batch filename for
 this to work. To extract the drive only, use STRINGS, or similar (I
 don't have a copy, so don't ask me to post it). Alternatively use
 the undocumented FOR %%V in /SOMETHING command, eg:

   set drive=
   for %%v in (/%0) do call test2 %%v
   echo Calling drive is %drive%

   where TEST2.BAT is:

   if not '%drive%'=='' set drive=%1:

 Disclaimer - I haven't tested this. Debugging is up to you.

 (You can, of course, fit this into a single recursive batch file -
 but that's left as an exercise for the student.)

 FOR %%V IN (/SOMETHING) DO WHATEVER will do WHATEVER twice - the
 first time with %%V set to the first character in SOMETHING ("S"),
 the second time with all the remaining characters in SOMETHING
 ("OMETHING"). If SOMETHING is only a single character, WHATEVER will
 only be called once, with that character in %%V. If the single
 character is a wildcard (? or *) that wild card will _not_ be
 expanded to a set of filenames. (The main purpose of this feature is
 apparently to allow inclusion of the literal characters "?" and "*" 
 without them being expanded.)

 This works in DOS 3.30 and 5 - I don't know about other versions.

                              Mitch Ames


 Example:

 I can get the date from the PC or from a file date stamp, but it's in
 the format MM-DD-YY. I need it have the same date echoed in the file
 name CDYYMMDD.ext

                              Brent Myhand


 The only way know to accomplish this in pure DOS is to use an
 undocumented feature of the "for" command. If the "set" starts
 with "/", for responds twice, once for the first character and
 once with all the remaining characters. To see this, at the DOS
 prompt try:

   for %x in (/abcde) do echo %x

 You'll get "a" and then "bcde". So the general idea is to strip
 off characters one at a time and build the new string. The problem
 is that the command after the "do" looks the same for the two passes.
 The only feasible command seems to be to call another batch file,
 which can get you pretty deep into nested calls if you're not careful.

 To distinguish the first and second call, you can set an environment
 variable before the first call to "STEP1," and have the place called
 change it to "STEP2."  To prevent the nesting per character, you can
 have the "STEP2" call save the remainder string in an environment
 variable and iterate at the main level. I think you'll also need a
 flag to tell you if you're working on the Month, Day, or Year part
 of problem.

 And, do you really get a 2 digit year, or do you get a 4 digit year?

 I think this does it:

   %echo off
   if NOT (%1)==(MORE) GOTO INIT
   if (%STEP%)==(STEP1) GOTO STEP1
   if (%STEP%)==(STEP2) GOTO STEP2
   GOTO END

   :INIT
   set STEP=STEP1
   set STR=%1
   set STAGE=M
   set DAY=
   set MON=
   set YEAR=
   set YYMMDD=

   :LOOP
   for %%x in (/%STR%) do CALL %0 MORE %%x
   if (%STR%)==() GOTO FINISH
   GOTO LOOP

   :STEP1
   set STEP=STEP2
   set STR=
   if (%2)==(-) GOTO NEWSTAGE
   if (%STAGE%)==(D) set DAY=%DAY%%2
   if (%STAGE%)==(M) set MON=%MON%%2
   if (%STAGE%)==(Y) set YEAR=%YEAR%%2
   GOTO END

   :STEP2
   set STEP=STEP1
   set STR=%2
   GOTO END

   :NEWSTAGE
   if (%STAGE%)==(D) set STAGE=Y
   if (%STAGE%)==(M) set STAGE=D
   GOTO END

   :FINISH
   SET YYMMDD=%YEAR%%MON%%DAY%
   set STEP=
   set STAGE=
   set DAY=
   set MON=
   set YEAR=

   :END

 If you need to trim 4 digit years down to 2 digits, you'll need to
 add some STAGES.

                              William Lipp


 The / causes the FOR command to break %1 into two parts: 
 the first character of %1 and the rest of %1. Take the line:

   for %%v in (/%1) do set word=%%v

 Say that %1 equals Lang, first time through word will be set to L,
 second time though it will be set to ang. Without the / it would
 be set to Lang.

 This is a very useful trick to know.

                              Scott Lambert


 From the command prompt type in

   for %x in (/abcd) do echo %x

 You will get "echo a"  followed by "echo bcd". The leading "/"
 causes "for" to split the string into the first character and
 the tail.

 if %1 is abcd, then line

   for %%v in (/%1) do set word=%%v

 results in

   set word=a
   set word=bcd

 so word ends as "bcd".

 then the line

   for %%v in (/%1) do if %%v%word%==%1 set char=%%v

 results in

   if abcd==abcd set char=a
   if bcdbcd==abcd set char=bcd

 so char ends as "a"

 The other lines handle the case where %1 is only one character.

                              William Lipp


 ... why won't this work:

   for %%f in (/h /H -h -H /? -?) do if "%1"=="%%f" goto @Help

                              Rene Verhagen
   

 What you could do to override this problem, is very simply write:

   for %%f in (H h ?) do if "%1"=="/%%f" goto @help
   for %%f in (H h ?) do if "%1"=="-%%f" goto @help

                              Raphael Neve & Gary Cooper


 The H and h should work, but the "?" inside a for-in-do is expanded
 by command.com into single-character filenames, so it would probably
 give unexpected results.

                              Gerry Pareja


 There are two problems here.

 First problem is, when you use a ? or a * in the FOR set, it looks
 for files that match the wildcard specification instead of using
 the actual ? or * in the string.

 Second problem is, the / calls up an undocumented feature of the
 FOR command. Try this from the command line:

   FOR %I IN (/12345) DO ECHO %I

 It loops twice, the first time produces a "1" and the second time
 produces "2345". If there's only one character after the / it loops
 once with just that one character.

 We can do what you want, but we have to split the loop into two
 lines. One to check for the /switch and another to check for
 -switch

   for %%i in (h H /?) do if "%1"=="/%%i" goto help
   for %%i in (h H /?) do if "%1"=="-%%i" goto help

 Because of the way / works in FOR sets, the /? sends a plain
 question mark instead of "/?" or a list of one-character filenames.

                              Steve Reid


ADDITIONAL FOR IN DO WEIRDNESS:

 Why does the following not work as expected?

   for %%z in (test1 test2 test3) do goto %%z
   goto end
   :test1
   echo test1
   :test2
   echo test2
   :test3
   echo test3
   :end

                              Greg Frizzle


 GOTO commands in FOR IN DO statements do not work correctly/as
 expected. This fragment will work in 4DOS, but not with
 COMMAND.COM. You've seen what happens when running under
 COMMAND.COM already. 4DOS will display test1 test2 test3.

 I was trying to explain... that GOTO's don't work right, and
 that IF's will break FOR IN DO's.

                              Bill George


 I fell for this, too. The strange thing is (on my MS-DOS 5
 system), the output from this batch file is

   test3

 I don't know why it doesn't go to label test1 and then fall
 through to

   :end

                              Jim Long


 I have been unable to break a FOR IN DO with an IF, nor do I
 find that GOTO's function incorrectly. I suspect that there
 might be some confusion here with the function in BASIC known
 as GOSUB.

                              Peter Lovell


 Bill George's point is a valid inclusion, I believe, because
 GOTO's in a FOR IN DO statement do not work the same way that
 other FOR IN DO's do. The FOR IN DO is only processed until the
 first GOTO is executed, and does not repeat for all members of
 the 'IN (set)' in the same way that MS-DOS treats other FOR IN
 DO loops (i.e. it doesn't.(loop))

 As far as IF's breaking FOR IN DO's I've had no experience of any
 inconsistency and sadly BG's comment gives no examples. I've
 tried several methods but cannot find any unexpected failures.

                              Mark J. Allen


 I finally figured out how to manage some crude edlin scripts, but
 found a serious weirdness: when running it under 4dos, it tends to
 endlessly loop. I can't figure out why...

   for %%a in (*.xxe) do edlin %%a < do.scr

 And what I've found is that the batch will loop on it's own, so
 that do.scr puts the text in each *.XXE file two or three times.

                              Todd Jacobs


 I've got the feeling I'm not going to be able to explain this
 particularly clearly, but here goes...

 The reason for the looping is that the "for..in..do" loop will
 go and get the next filename as it executes, rather than building
 a table with the filenames in it and going through the table.
 So, if you have three .XXE files, the loop executes three times,
 then checks to see if there's a fourth file - and it finds another
 three, namely the "new" versions of the original three which have
 been edited and are now sitting somewhere else on your disk. So
 it processes what it thinks are files four, five and six, then
 looks for a seventh - and finds the same three files edited yet
 again to look like files seven, eight and nine.

 I believe this only occurs when the order of the files in the
 directory - bearing in mind that the true order may not be visible
 to you if you have overridden it with DIRCMD - is affected by the
 operation which is being carried out in the loop, so for example,
 merely reading the files will not cause this "weirdness", but
 EDLINing them will, since the original file is renamed .BAK and
 a new image of it is created elsewhere on the disk.

                              Rudy Lacchin


 I want to see if an environment variable is equal to 00, and if
 it is, change it to --. Something along the lines of:

   set z=00
   for %%x in (%a% %b% %c%) do if "%%x"=="%z%" set %%x=--

 Can this be done?

                              David Farrington


   :--- Initializing some variables ---
   set A=VA
   set B=
   set C=00
   :--- Your code ---
   set z=00
   for %%x in (%a% %b% %c%) do if "%%x"=="%z%" set %%x=--
   set
   :END

 This will show the following:

   A=VA
   C=00
   Z=00
   00=--

 Not quite what you wanted, but the effect is interesting and
 worthy of saving in one's little bag of .BAT tricks. That
 is, one can set a variable whose name is in a FOR index,
 derivable from another variable or argument (or, I assume,
 the name can be given directly via another variable or an
 argument).

 I was going to say, "the answer to your problem is simple"
 and proceed to change your code by merely taking out a '%'
 or two. But it doesn't seem possible. The straightforward
 way to do it is not to use FOR at all, but simply

   IF "%A%"=="%Z%" SET A=--
   IF "%B%"=="%Z%" SET B=--
   IF "%C%"=="%Z%" SET C=--

 Terribly mundane, however. The challenge you pose relates to
 a question I asked more than a month ago, and which stumped
 me for a similar reason: it seemed impossible to retrieve the
 CONTENTS of an environment variable when its NAME is itself given
 as any kind of variable (an environment variable, an argument,
 or a FOR index - anything requiring a percent sign for its
 expression).

 However, you have inspired me to give the problem a little more
 thought, and I have found a way out, although it requires a batch
 file to write and run another batch file.

 The key to this is that '%%' in an ECHO statement gives us a
 single literal '%'. (If for some reason this does not work,
 perhaps you can still SET PCT=%% and get '%' as %PCT%).

 Now, if we have PTR=NAM and NAM=VAL, we can get VAL from PTR thus:

   ECHO SET GOTIT=%%%PTR%%% >TMP1.BAT
   CALL TMP1.BAT
   DEL TMP1.BAT
   ECHO The answer is %GOTIT%

 A similar technique will do what you want using FOR. It is
 convoluted and relatively impractical with only three elements;
 but if you had many to check, or if any of the components of
 FOR() were themselves a variable, it might become an empowering
 tactic:

   if "%1"=="DO1" GOTO DO1
   set A=VA
   set B=
   set C=00
   set z=00
   for %%x in (a b c) do call %0 DO1 %%x %z%
   del TMP1.BAT
   goto end
   :DO1
   echo IF "%%%2%%"=="%3" SET %2=-- >TMP1.BAT
   call TMP1.BAT
   :END

 I am intrigued by this as a programmer in the C language, where
 (as you probably know), indirection by means of pointers is
 ubiquitous. It is common to use a pointer to refer to an element
 of an array. It is less common, but still often useful, for a
 pointer to mark one of several scalar variables. At run time
 this is done via addresses, of course, not names. However, in
 batch language, environment variables do not have addresses in
 any practical sense, and their names are all we have by which to
 grab them. Although the .bat application which first caused me
 to think about this issue is long forgotten, I remain hopeful
 that if we keep it in mind as a live option, uses will occur to
 us.

                              Paul Emmons


 On Sunday February 06 1994, Rob Flor wrote to Quang Sun:
 
 QS>> For %1 in (TEFILE tefile GWS gws) do Goto %1
 RF>       ^                                     ^
 RF>   should be %%f 
 RF>              where "f" is
 RF>              alphabetic, not numeric.

 I've seen a few people state that the control variable in a
 for..in..do loop must be a letter, but %%1 and even %%? work
 just as well. No?

                              Rudy Lacchin


 I tested this and it works without a hitch even when there is
 a %1 variable on the command line?

                              Gary Cooper


 Unfortunately, FOR-loops cannot be nested. If they could, we
 could say:

   for %%f in (h H /?) do for %%g (// -) do if "%1"==(%%g%%f) goto @Help

                              Rene Verhagen


 It *is* possible to nest FOR loops, by using COMMAND /C...

   for %%f in (A B C) do command /c for %%g in (1 2 3) do echo %%f%%g

                              Steve Reid


   for %%b in (zip arj arc lzh nws gif exe msg txt) do...
   ...if exist *.%%b goto files >nul

                              Terry Jackson


 Your above example is working fine here under MS-DOS v6.22.

                              Vernon Frazee


   for %%b in (zip arj arc lzh nws gif exe msg txt) do...
   ...if exist *.%%b pcopy *.%%b \tlxdump /x/ba >nul

 The if exist still doesn't seem to work in this one.

                              Terry Jackson


 Give it a try by CALLing PCOPY; like so:

      ...if exist *.%%b CALL pcopy...

                              Vernon Frazee

===============================================================================
17) FORMAT

EDITOR'S NOTE:

 This section contains a discussion about how one may format a
 disk(ette)s by the quickest means available. It is most difficult
 to separate the various suggestions as the discussion blends from
 one proposed method into the next, please bear with the text.

FORMAT A: /AUTOTEST

 The autotest parameter will allow format to proceed, checking
 existing format (unless the /u parameter is also present) and
 proceeding with the format.

 All this will take place with no delay and no waiting for user
 input. It will also end without pausing. It will not ask for
 a volume label or whether to format another diskette.

   WARNING! This procedure will also work on hard drives! Be very
   cautious if you plan to use this feature.

                              Wayne Woodman


 FORMAT/U is not available in DOS 3.30

                              Mitch Ames


 It won't take any other switches like /U, /S or /Q which is
 a bit of a shame really.

 When I try it with Dos6 I get the following error message:

   Parameters not compatible.
   Format Terminated.

                              Peter Lovell


 /U and /S both work together with /AUTOTEST with my copy of
 MS-DOS 6.00. Did you possibly use an illegal combination of
 switches?

                              John Evans


 With Dos 5 it certainly takes /u and /s as I have used it, in
 fact I think /u is required if the disk is not pre-formatted
 as the drive hangs up otherwise.

 I would agree about /q though, this does not work and gives
 the error message you quote.

                              Terry Kreft


 Have you ever tried:

   FORMAT A: /Q /U /AUTOTEST

                              Pete Dinnella


 This doesn't work in my DOSs (IBM DOS 5.02 and OS/2). You can't
 combine /Q AND /AUTOTEST

                              Asbjorn Hojmark


 I have loaded my F5 key with ANSI.SYS so when I press it I get

   FORMAT A: /F:720 /U /AUTOTEST

 This DOES work.

                              Pete Dinnella


EDITOR'S NOTE: In response to requests for the fastest way to
format diskettes. Vernon Frazee has offered the following
solutions. These techniques generated a great deal of
discussion pertaining to the validity and relative merits of
each method.

REN /?|FORMAT %1 /q /u /v:"%2">NUL

 Most of the solutions I've created and used, or seen... echoed
 the necessary responses out to a temporary file, redirect the
 contents of that file back to the FORMAT command, and then deleted
 the file. Inefficient!

 If you type the command:

   format a: /q /u /v:""

 FORMAT will 'quick format' a diskette in A:, unconditionally, and
 without prompting for a volume label, which is all well and good,
 BUT for many, the two prompts:

   Insert new diskette for drive A:
   and press ENTER when ready...

 and then:

   QuickFormat another (Y/N)?

 get real old after a while. We DON'T have time to play. We wanna
 slam a disk in the drive, hit a few keys and have a formatted disk
 ready to go... now! <g>

 The solution of course is some way to send a "carriage-return"
 response to the first prompt, and then a "N" and "carriage-return"
 to the second. And, like I stated above, most use a temporary
 file to store these keystrokes and then delete it.

 Well check it out. If you're using MSDOS v5.00 or higher (haven't
 tried it with anything earlier yet) stick a previously formatted
 diskette in drive A: and try the following command:

   ren /?|format a: /q /u /v:""

 and the text generated by the "REN /?" portion of the command lands
 you back at the DOS prompt no questions asked! Yea yea, I know, the
 output is ugly but hey, it works! If you'll simply add a ">nul"
 (not the quotes) to the end of the line it'll hide the mess.

 Here's my QF.BAT(ch) solution built around the above:

   @echo off
   :QF.BAT - Quick Formats diskette in specified drive (with
   :         optional volume label). Type "QF /?" for syntax
   for %%x in (a A b B) do if (%1)==(%%x:) goto BEGIN
   for %%x in (a A b B) do if (%1)==(%%x) QF %1: %2
   :Syntax .................................................
   echo Syntax: QF d[:] [volume_label]
   echo  Where: d is either drive A or B, (":" optional)
   echo    and: volume_label is an optional volume label
   goto END
   :BEGIN ..................................................
   echo Quick formatting diskette in %1...
   if not (%2)==() echo and adding label "%2"
   ren /?|format %1 /q /u /v:"%2">nul
   echo Task complete.
   :END .............................................. -vjf-
   
 If you'll stick the above in a directory in your PATH all you have
 to do to 'quick format a diskette in A:' is type:

   QF A

 (or "QF B") and you'll have "no questions ask" formatted diskette
 ready to go in 7-8 seconds.

                              Vernon Frazee


EDITOR'S NOTE: This shorter version of QF.BAT eventually evolved
into the following:

 "a BATch file named QF (Quick Format) that ONLY allows formatting
 diskettes in drive A: or B:. The entire BATch file is built around
 the single command (which I use in a DOSKEY macro instead of a
 BATch file):

   ren /?|format %1 /q /u /v:"%2">nul

 Here's my QF.BAT solution (again):

   @echo off
   :QF.BAT v1.1 -----------------------------------------------------------
   :Purpose: Quick Formats diskette in specified drive (with
   :         optional volume label). Type "QF /?" for syntax
   for %%x in (a A b B) do if (%1)==(%%x:) goto BEGIN
   for %%x in (a A b B) do if (%1)==(%%x) QF %1: %2
   :Syntax ----------------------------------------------------------------
   echo Syntax: QF d[:] [volume_label]
   echo  Where: d is either drive A or B, (":" optional)
   echo    and: volume_label is an optional volume label
   echo   Note: DOS's CHOICE.COM is used if an error occurs
   goto END
   :BEGIN -----------------------------------------------------------------
   echo Quick formatting diskette in %1...
   if not(%2)==() echo and adding label "%2"
   ren /?|format %1 /q /u /v:"%2">nul
   if errorlevel 4 goto ERROR
   if errorlevel 3 echo Task terminated.
   if errorlevel 3 goto END
   if errorlevel 0 echo Task complete.
   if errorlevel 0 goto END
   :ERROR -----------------------------------------------------------------
   echo.
   echo Error reading drive %1!
   echo.
   echo a) Is the disk inserted correctly and the drive door closed?
   echo b) Maybe the disk is write-protected or "%1" is the wrong drive?
   echo c) Has the disk in drive "%1" ever been formatted before?
   echo    (QF won't work on a disk that's never been formatted).
   echo.
   choice /c:ar Your choice: Abort or Retry 
   echo.
   if errorlevel 2 goto BEGIN
   echo Task aborted.
   :END ------------------------------------------------------------- -vjf-"

                              Vernon Frazee


EDITOR'S NOTE: In response to these suggestions Vernon received
the following feedback:


 If you type the command:

   format a: /q /u /v:""

 FORMAT will 'quick format' a diskette in A:, unconditionally, and
 without prompting for a volume label, which is all well and good,
 BUT for many, the two prompts:

                              Vernon Frazee


 Have you ever tried:

   FORMAT A: /Q /U /AUTOTEST

 The undocumented /AUTOTEST switch will not ask you to insert a
 disk nor will it ask for a volume label or if you want to format
 another! I have loaded my F5 key with ANSI.SYS so when I press
 it I get

   FORMAT A: /F:720 /U /AUTOTEST

 (I use a lot of 720k 3.5's) Now with the press of a single key I
 pump out a 720 floppy pretty damn quick! Try it! P.S. I know this
 works with DOS 6.0. Don't know about 5.0 and below!

                              Pete Dinnella


 I did... on every version of MS-DOS since 4.0. And neither of the
 undocumented FORMAT parameters, "/AUTOTEST" or "/BACKUP" will work
 with the "/Q" parameter. In fact both return the same error message:

   format a: /q /u /v:"" /autotest

 and,

   format a: /q /u /v:"" /backup

 return the error:

   Parameters not compatible.
   Format terminated.

                              Vernon Frazee


 Question, Why not redirect a text file with the necessary
 keystrokes in it to the format command?

                              William Johnson


 1) If you store the "text" file on the hard drive permanently it's:

    a) Wasting a minimum of one cluster and
    b) You have to wait for DOS to find and read the file
       (so it can redirect it to the FORMAT command)

 2) If you are echoing the keystrokes out to the "text" file instead,
    you have to wait for:

    a) DOS to write the file
    b) DOS to find and read the file (to redirect it to FORMAT)
    c) DOS to delete the file

                              Vernon Frazee


 You did great down to here, Vernon! The rest is wrong.

    VF> ren /?|format a: /q /u /v:""

 is faster because it uses REN (a DOS command already in memory).
 (It doesn't have the additional delay of reading and/or writing
 the extra "text" file to and/or from a slow mechanical disk).

 To test what I'm saying, Vernon, use a .BAT such as this:

   @echo off
   set xemp=%temp%
   set temp=a:\
   ren/?|format b:/q/u/v:""
   set temp=%xemp%
   set xemp=

 If you want to read the output of REN/? from drive A:, just
 UNDELETE the newest file on drive A: and read it. If I remember
 right, the pipe puts TWO temporary files on disk that have to be
 deleted. One of those is zero length and can't be read but it's
 still an additional file that must be written and subsequently
 deleted from the disk.

 It seems that this should be covered in the DOS manual but if it's
 there, I've never seen it.

                              Billy Gilbreath


EDITOR'S NOTE: In response to another suggestion from Vernon Frazee.


  FORMAT A: /Q /U /S /V:"" /F:1.2

                              Vernon Frazee


 /Q and /U are mutually exclusive options. Actually, it just kind
 of ignores the /q. Also putting the "/U" is really unnecessary
 unless you have reason to suspect bad media. If "/Q" cannot
 determine the media type, it defaults to "/U" format.

                              Steve Adams


 /Q is not kind of ignored at all.
 /U is by no means unnecessary, if you do not use it then format
 will check the disk and save the "Unformat" information, this
 takes time, try doing a quick format with /U and without it, the
 difference in processing time is significant.

 Also /Q does not "default" to /U format, it asks for user input
 as to whether it should proceed with an unconditional format,
 sometimes!

 Following this message I spent two hours playing around with
 FORMAT, and the number of responses it gave to differing
 conditions was quite remarkable.

 For instance when I said that /Q does not default to /U but
 requires user input sometimes I was referring to the following
 cases:

   MSDos 6.20, 1.44m floppy drive:

   1.44m floppy disk, unformatted.

 Command line> FORMAT A: /V:"" /Q /F:1.44

 The user is _not_ asked whether to carry out an unconditional
 format, FORMAT just carries on and does it.

   720k floppy disk, unformatted.

 Command line> FORMAT A: /V:"" /Q /F:720

 The user is _not_ asked whether to carry out an unconditional
 format, FORMAT just carries on and does it.

 So what does the following command line do (1.44m floppy disk):

 Command line> FORMAT A: /V:"" /Q

 You would think that this should work the same as example (1)
 above as the /F:1.44 should be implied. It doesn't, the user
 is _asked_ whether to perform an unconditional format, it does
 not just carry on and perform one.

 I found a number of anomalies in the way format handled different
 disk sizes in the above set-up and the conclusion I reached was
 that it was unsafe to reach a conclusion on _anything_ format
 will do, without trying the specific situation out first.

 The one thing I did find though was that /U gives significant
 speed improvements in all situations (maybe! <G>).

 Why do you use the /f switch with format /q as it is redundant,
 the /q forces the disk size to be retained anyway. Please see
 below for a test of this I did.

   DOS screen capture                           Comments
   ============================================ ========
   C:\format a: /q /u /v:"" /f:1.44             +- Note /f:1.44
   Insert new diskette for drive A:             |
   and press ENTER when ready...                |
                                                |
   Checking existing disk format.               |
   QuickFormatting 720K                         +- Note its actually
   Format complete.                             |  formatting to 720k
                                                |  as this was the
                                                |  original disk
   730,112 bytes total disk space               |  size.
   730,112 bytes available on disk              |
                                                |
   1,024 bytes in each allocation unit.         |
   713 allocation units available on disk.      |
                                                |
   Volume Serial Number is 3F2D-13DE            |
                                                |
   QuickFormat another (Y/N)?n                  |
                                                |
   C:\                                          +- Done

 So as I say the /f is redundant.

                              Terry Kreft



FORMAT C: /BACKUP


 This week I've read some articles in Dutch computer magazines about MUF's
 which are very interesting (if you don't already know about them).

 I already knew the FORMAT option /AUTOTEST, but new to me was the
 /BACKUP option.

 EXAMPLE: FORMAT A: /BACKUP

 It seems to work exactly like /AUTOTEST, but it DOES ask for a volume
 label.
                              Willem Van.den.broek

  
FORMAT/SELECT/U

 is like DOS-Mirror... for safety-fanatics only

   FORMAT/SELECT/U

 makes disks unreadable (remember the U)

                              Reinhard Kujawa
                              Info from The German magazine PC PRAXIS


 FORMAT /SELECT calls MIRROR after formatting.

                              Patrick Feisthammel


 Here's a rough translation of what my DOS6 book (written by
 Hans C. Nieder) says about it:

 /SELECT/U   This is a very dangerous option. Within 1 to 2 seconds,
             and without further prompting, the disk(ette) will be
             unformatted in such a manner as to make recovery
             impossible. This might prove useful for reasons of
             data protection, e.g. destroying sensitive data.

                              John Evans


FORMAT /H

 In DOS 3.30 (I don't know about other versions), FORMAT /H
 will cause the format to begin immediately after pressing Y
 in response to "Format another?", rather than displaying
 "Place disk to be formatted in drive A: and press Enter" on
 a second and subsequent disks.

                              Mitch Ames


 On 5.0 it comes back as "invalid switch".

                              John Mudge

===============================================================================
18) IF EXIST

 IE: IF EXIST EMMXXXX0 GOTO APPLICATION

 This is a handy quirk of DOS - installable drivers are seen as files
 in all directories. You can use the if exist test to either test for
 the existence of a directory, with "if exist <dirname>\nul", (which
 fails if the directory does not exist because the nul device is not
 found,) or to test whether a driver is loaded.

 Caveats: you need to know the name of the directory or the driver
 whose existence you are testing, and this is MS/DOS specific - it
 doesn't work on network drives, and may not work under DR-DOS.

                              Gary Marden


 This works definitely under DRDOS:

    DR DOS Version 6.0
    Copyright (c) 1976,1982,1988,1990,1991 Digital Research Inc.
    Alle Rechte vorbehalten.

      C:\>if exist emmxxxx0 echo ja
      ja

                              Wolfram Serber


 Where did you learn the "EMMXXXX0" name from?

 Instead of typing MEM /C, type MEM /D for the "debug" listing.
 That should give the names you're looking for.

                              Erik Ratcliffe


 The trouble is, EXISTS returns TRUE for COM3/4 and LPT2/3 even
 though the hardware does not exist.

                              Rudy Lacchin


   if exist ?:\nul

 does not return true on cd rom drives.

 This can be a very effective copyright protection scheme for
 programs distributed on cd rom disc. If the program is copied to
 another media it won't run because "if exist <current drive>:\nul"
 will be true. (Provided the author included such a check in their
 code.)

                              Terry Blount


 Verified this works with 4DOS too. Legal devices were XMSXXXX0,
 DBLSSYS$, CLOCK$, NUL, AUX, PRN, CON, COM1 thru 4, and LPT1 thru4.

 All returned yes to the statement: if exist device echo yes

                              Bill George


 "If Exist" will only check for the existence of a file, but there
 is a "Loophole" or "Quirk" in DOS that you can take advantage of.
 Although they never show up in a DIR listing, any DOS DEVICE will
 show up a file to

   If Exist d:\path\devicename command

 and it will return true if the directory "d:\path" exists.

                              Matthew Lewis


 A little known quirk of the above, it will *always* say that the
 directory \dev exists, even if it doesn't. Try it and see.

   if exist \dev\nul echo yep

 It's just Dos trying to be like UNIX. In UNIX, the devices exist
 *only* in the /dev directory.

                              Steve Reid

===============================================================================
19) INSTALLHIGH

 I think I may have found an undocumented feature for DOS 6....
 I wasn't able to find this anywhere in the online help. It's
 called INSTALLHIGH= and amazingly enough it works just like
 INSTALL= but loads the file high!

 The only drawback to this is: Memmaker will not go through and
 add switches for that particular line during the "optimizing
 process". It just takes it as it is currently. But then again
 INSTALL= is ignored too!

 Example:

   DEVICE=C:\DOS\HIMEM.SYS
   DEVICE=C:\DOS\EMM386.EXE NOEMS HIGHSCAN WIN=F500-F7FF WIN=F200-F4FF
   dos=HIGH
   dos=UMB
   installhigh=c:\dos\share.exe

                              Robin Francis


 MUF reported in the magazine C'T: You can use the DOS 6.0 command
 "installhigh" in config.sys to load TSR programs into UMA. A 48 byte
 environment will be added for every program. If you use it you don't
 need the "loadhigh" in autoexec.bat any more.

 But Memmaker can't handle installhigh!

                              Thomas Erbe


 Further to Robins explanation, INSTALLHIGH cannot be directed to a
 specific UMB area and thus defaults to largest currently available.
 Like INSTALL it is processed (about) last of C.SYS lines and causes
 more consumed RAM overhead than calling TSR from A.BAT or later.

                              Richard Pade


 There is an undocumented CONFIG.SYS command called INSTALLHIGH. It
 is similar to INSTALL except that it will load the TSR into an UMB.
 It is available under DOS 6. However, it does not support the
 /L and /S switches that DEVICEHIGH and LOADHIGH support.

                              Tom Dyas


 Then it is useless, isn't it? It has less than the capabilities of
 LOADHIGH and DEVICEHIGH but load the same TSRs that they load... no
 wonder it is an undocumented command.

                              Wayne Moses


 Just wondering, does INSTALLHIGH work with Microsoft DOS 5? It
 would also be nice to know why it is undocumented. It doesn't do
 anything major! Microsoft gains nothing by keeping it undocumented.
 Loading TSR's from CONFIG.SYS is better because an environment is
 not allocated for the TSR. A very small amount of memory is
 conserved, but it is still conserved.

                              Tom Dyas
 
===============================================================================
20) MEM

MEM /A or MEM /ALL

 Playing around with DOS 6.2 MEM command, I recovered a undocumented
 Option (at least undocumented in the german version).

 MEM called with option /? explains 5 options:

   /D(EBUG), /F(REE), /M(ODULE), /C(LASSIFY) /P(AGE)

 Not mentioned is the option /A(LL). I compared the output of a plain
 MEM-cmd and the output of MEM/A; the only difference is following
 additional line:

 Freier Speicher im oberen Speicherbereich    1K   (864 Byte)
 (Free memory in high memory area (HMA))

 /A is the only option forcing this statement.

                              Michael Dehlwes


 It is not documented in my English copy of DOS 6.2 either, but does
 work exactly as you (MD) described.

                              John Mudge


 If you do a MEM /A it'll give you details of what's in the first meg
 of memory.

 Windoze owners get MSD.EXE (a pretty undocumented utility), that tells
 you this sort of thing. If you do a MEM /A it'll give you details of
 what's in the first meg of memory.

                              Ben Davis


 What is this MEM /A in the MUF list supposed to do? Ben Davis says
 that it's  supposed to "give details of what is in your first meg of
 memory." Don't the  /P, /C and /D switches already do that?

 When I ran it here under DOS 5.0, I got an "invalid switch."

                              Bruce Bowman


 I am wondering if the switch "ALL" is documented in any DOS
 manuals? It's not in the HELP command or the MEM /? command,
 but it is a functioning switch and it is in the code, /ALL
 reveals free HMA.

 This is the MEM from the 6.22 Step-Up dated 5-31-94. Is this
 available in prior versions?

                              Chad Wagner


 It is avail in my 6.20... I too, was unable to document the
 /ALL switch, either in the O/L help or in the 6.0 'manual'.

                              Bat Lang


   MS-DOS Version 5.00

   Invalid switch -  /all

 That's what I get when I try to run that command line here.

                              Darren Ryall


 It's not in the PC-DOS 6.3 manual, certainly, but it's available
 as a parameter both there and in MS-DOS 6.20.

                              John Gray

===============================================================================
21) MOUSE

MOUSE /U

 Microsoft mouse driver version 8.1 has a /U switch. Adding that switch
 loads all but 3.3k of the driver into HMA. It's not quite the most
 recent version mouse driver, but hey, a mouse driver is a mouse driver
 is a mouse driver, right? Especially when it only takes 3.3k of ram!

                              Mark Carter


 Are you getting that result by loading the mouse driver high on a 286?
 If so, that is good news. Mine takes up 12k of main RAM (MS mouse
 driver ver. 7.0).

                              Gerry Pareja


 Mouse 8.0 _is_ able to load itself into HMA (I think) on a 286 by using
 the undocumented /U switch. I read it in PC Magazine sometime back.
 Also, PC Mag said that the BUFFERS have to be set to a low value, e.g. 5.

                               Ng Cheng Kiang

===============================================================================
22) MULTIPLE DOS COMMANDS ON ONE LINE

 set &=%4&|set n$=%4|set m$=%3|set #=%2|set !=%0 
         /|\       /|\       /|\      /|\ 
          |_________|_________|________|____________Separators


 The separators (|) used in the line, are these doing anything
 other than separating commands? Can this be used for entering multiple
 commands on any line in a batch file regardless of type of command?

                              Peter Joynson


 I believe you are right about this, but I think it pipes any output from
 the previous command to the next one (your example doesn't have any
 output. For example: ECHO Y|ERASE *.*  This would pipe the Y to the
 command ERASE *.* so you wouldn't have to enter the Y for the "Are you
 sure" prompt.

                              Robert Hupf


 The | is a pipe symbol, well documented in your DOS manual. (Read it
 before you read the rest of this message if you don't know about
 pipes already, otherwise the rest won't make sense.) Pipes can be
 used to put multiple commands on a single line, provided that the
 first command does not write anything to StdOout which might cause a
 problem when read by the second command as StdIn. Also, it is assumed
 that you don't want to see the output of any but the last command,
 since each command's output will be piped to the next's input. Note
 that in this case SET neither writes anything to StdOut nor reads
 StdIn. Thirdly, you must have write access to the current drive, or
 %temp% if defined, since a pipe always creates a temporary file. Eg
 this would not work if run from a write protected floppy (unless
 %temp% was defined), since DOS would fail to create the temporary
 files.

 Pipes create temporary files even if no actual data is sent to
 StdOut because Command effectively treats this:

   prog1 | prog2

 as something like this:

   prog1 > %temp%tempfile
   prog2 < %temp%tempfile
   del %temp%tempfile

 Even if prog1 doesn't create any output, at least one zero length
 file is created. To demonstrate, try this

   set temp=
   set | dir

 I must say this beats the usual boring old "how do I echo a blank
 line in a batch file" etc.

                              Mitch Ames


 I've done my share of DOS batch file programming but I just stumbled
 across this this evening. Oh, I've known about ^M for some time but
 saw them only as a pain in DOS->Unix file conversions. I never thought
 about "power using" them under DOS. I mean, gee, we have our ANSI.SYS
 driver, don't we?

 If I were to it under Unix I would:

   if [ -f bonk ]
   then
   echo "yes, bonk exists!"
   echo "take a look:"
   ls -l bonk
   fi

 notice the number of commands we can execute in this "nifty"
 conditional statement. What I found that you can do under DOS is:

   if exist bonk echo yes, bonk exists^Mecho take a look:^Mdir bonk

 BTW, those "^M" are control-em's (ASCII 13)

                              Pat Goss


 This works as is under 4DOS, but COMMAND.COM prefers a space after
 the ^M's. It *assumes* that there are ^J's there.

                              Maynard Hogg


 I will tell him that even if the file doesn't exist it will still
 do:

   echo take a look:^Mdir bonk

                              Chad Wagner


 What versions of DOS is this supposed to work under? I tried it
 with 4DOS, and it executed the second ECHO and the DIR whether the
 file exists or not. Same thing running under MDOS' COMMAND.COM (MDOS
 is OS/2's DOS emulator).

                              Scott Wunsch


   ECHO.| TIME > TIMER.TXT

 Would the pipe also work with del, ie Y|del *.*

                              Jeff Earle

===============================================================================
23) PATH

 With MS-Dos 6.0 you CAN exceed the normal path length limit by
 putting a "Set Path=C:\;..." in your Config.Sys file instead of
 your AutoExec.Bat file. The usual limits do not apply there.

 I have put in a path well over 800 characters and it works fine.
 The path doesn't display correctly via PATH or SET, but it's in
 there and it all gets searched.

 I don't recommend having a path that long, mine is normally
 only 6-8 directories.

                              Andrew Barnhardt


 To change drive you need not extract the drive from the path.
 If you have the path %P% for example, just do:

   %P%\
   cd %P%

 Works with MS-DOS, Novell DOS (Don't know about 4DOS, PC-DOS).

                              Horst Schaeffer


 Indeed it does work with MS-DOS. The backslash at the end of
 the path is vital. Fortunately, it makes no difference if there
 are two or more.

                              Gary Smith


 That trailing backslash certainly does the business -  I've always
 stripped the D: never thinking that the simple addition of a
 backslash would save lines of code.

 I've never seen this before but can confirm that it works flawlessly
 with MS-DOS v5.01a.

                              Mark J. Allen


 Funny thing is: the path does not have to be valid, even some
 delimiters will do the job, for example:

   D:\\
   D:NUL\
   D:;=,\

 But it will fail with wildcards (!)

                              Horst Schaeffer


 Why do you want to peel off the drive letter and colon? Aren't
 they part of the current directory?

                              Phi Nguyen


 As a simple example, if you're on drive H: in the \FOOBAR
 directory and you need to get to C:\WINDOWS you can't just
 type:

   cd c:\windows

                              Vernon Frazee

 
 Under 4DOS, the first command will not only change the drive, but
 it will also switch to that directory! ie. Current is D:\FILES\NEW,
 I type E:\POINT\IN\, and poof! Current directory is E:\POINT\IN.
 One of 4DOS' nicer features. This also worked under PC-DOS version
 3.1, but you need to issue both commands (%P%\ and cd %P%).

                              Mike Ledoux


 That's good news. Im use this trick in my INSTALL.BAT, and I wondered
 if there were any problems with 4DOS or PC-DOS.

 This is to make sure that the diskette drive is selected in an
 INSTALL.BAT:

   if not exist MYFILE %0\

 where MYFILE is a specific file supplied on diskette.

                              Horst Schaeffer


EDITOR'S NOTE: In response to a request for information as to
how to add a directory to the current path via a batch file, I
made the following suggestion:

 Since the current PATH is contained in the environmental variable
 PATH, you could try using:

   SET PATH=%%PATH%%;C:\DIR

 This sets the new PATH (PATH) to contain the current EV PATH
 (%%PATH%%) plus what you wish to add to the PATH (;C:\DIR).

 However, the individual making the request expressed concern
 about whether the current path ended with a ";" and how to
 detect this possibility to avoid problems. One individual did
 some experimentation and provided the following insight: 
 (Whether this qualifies as a true MUF I will leave open to
 discussion)

                              Gary Cooper


 This may not be neat but I experimented and found out that if
 there are two semi-colons in a row in your path statement that
 DOS just ignores this and sets your path anyways. For example
 it doesn't seem to matter if your path statement/environment
 variable ends in a semi-colon or not. So you can go ahead and
 append ;C:\DIR to the end of your path and the path you wish to
 add will be incorporated. It isn't the perfect solution if you're
 "picky" but it works (at least in DOS 6.2). If you really have
 to know if your path ends in ; then experiment with the FIND
 command.

 ...with my autoexec.bat I found that if there are two semi-colons
 in a row... your path is still set as you wish. This means that
 you don't have to worry whether or not your path ends in a ; but
 can go ahead and append ;c:\dir to your path. Works with DOS 6.2
 anyway. If you are a perfectionist and don't want to see ;; in your
 new path try using FIND /I to see if it will locate a ; at the end
 of your path environment variable and then branch in your
 install.bat file based on the errorlevel returned by FIND.

                              Russ Amiro


EDITOR'S NOTE: A common problem using MS-DOS is case sensitivity.
Gerry Pareja has demonstrated how PATH can be used to convert to
upper case. IE:

 Begin with the valid commands and the "empty command" then put
 a "goto :ERROR" on the next line:

   if %1. == . goto :ERROR
   if %1  == A goto :A
   if %1  == B goto :B
   if %1  == C goto :C
   goto :ERROR

 Thus the batch file will go to ":ERROR" if none of the
 conditions are met.

                              Bruce Wilson


 You'd still have to worry about upper-casing the input, or check
 for both A and a, B and b, etc.

 Here's a built-in upper-case routine (a DOS kludge!):

   set dummy=%1
   :: convert to uppercase:
   set oldpath=%path%
   path=%dummy%
   set dummy=%path%
   path=%oldpath%
   set oldpath=

 Now "dummy" contains an upper-case version of %1, so tests for %1
 become tests for %dummy%. Works well.

 (The explanation: "path=" forces uppercase, while "set path="
 retains the original case. Don't ask me why. Ask Microsoft.... ;-)

                              Gerry Pareja

===============================================================================
24) REN or RENAME

 Here's something that I believe qualifies as a MUF. It works in
 MS-DOS 5.0 and probably in other versions as well, although I
 haven't had an opportunity to test any.

 You can create filenames with embedded spaces from the DOS
 command line by using the RENAME command with the "?" wildcard.
 For example, if you have a file named FILE.TST, the command

   REN FILE.TST FILE?1.TST

 will produce a file with the name "FILE 1.TST".

 So far as I know, this feature has no practical use whatever.

                              Gary Smith


 I tried this under MS-DOS 6.2. When trying to rename WIN4.TXT
 to WIN?4.TXT, I got WIN44.TXT. To go back, I tried:

   ren WIN??.TXT WIN4.TXT 

 it worked. Also, with a typo, I found that ren WIN4.TXT to
 WIN4?.TXT gets a 'duplicate file name' message. Strange.

                              Julian Corey


 The trick is that the question mark in the target filename must
 align with an unused position in the source filename. Renaming
 WIN4.TXT to WIN4?4.TXT works in this manner.

                              Gary Smith


 Also works with 3.3, 4.01, 6.00 and 6.20.

                              John Evans


 Because c.com normally uses the ? as a single char wildcard
 this will work only if its char position in the destination
 occurs past the end of the source file's name (as Gary's
 example) and if it (or they, more than one ? is ok) are/is
 followed by at least one valid character before the period.
 I don't know of any useful function apart from ensuring unique
 naming, perhaps, for temp files.

                              Mark J. Allen


 Knowledge of this MUF has two possible uses to which I have
 put it. It makes the file undeleteable unless you know that
 renaming it to a legitimate filename can be done in the same
 manner in which you created it. The renaming and running
 then renaming back to a filename that makes the file
 undeleteable and unrunnable can be done from within another
 program in order to protect it.

 Just knowing that your process can be reversed....

   REN FILE?.TST FILE.TST

 gives you the ability to save files that otherwise sometimes
 appear and cannot be deleted or run...

                              John Mudge


EDITOR'S NOTE: The following excerpts were captured from a
discussion about the use of wildcard characters during the
process of renaming files. More experimentation may be
helpful in this area:


 '?' is for single-character masking, '*' will match any
 number including zero.

                              Don Hoffman


 If DOS finds an asterisk, the rest of those 8 or 3 bytes is
 filled up question marks.

                              Horst Schaeffer


 I know that's what the books say, but it's not quite that simple.
 If it were, it would only handle full 8/3 filenames.

 '*' is very context-dependant. For RENames and COPYs it
 almost never gives the desired result if it is accompanied by
 other characters on the "target" side of the command.

                              Don Hoffman


 I never had any problem with expressions like: XY*.Z*
 (MS-DOS 5.0) Of course, any character succeeding an asterisk
 is ignored.

 Did you find any reproducible misbehaviour?

                              Horst Schaeffer


 Let's see... I think REN ABC*.* ZZZ*.* was the sort of thing
 that would really irk me. (It's been several years since I used
 '*' in conjunction w/ characters on the target side of a command;
 As I said, I learned better.)

 I think I recall that the result would be 1 rename to ZZZABC?????.*
 truncated to 8/, and a whole bunch of error messages about "File
 Already Exists" for everything that truncated the same way. Of
 course this also destroyed the ending characters (which I needed
 for identification) of all the ones that did get renamed.

 What I actually wanted could be obtained from REN ABC?????.*
 ZZZ?????.*, explicitly requiring a full 8 on both source and
 target, to get the desired ZZZ's while retaining the rest of
 the original names for identification purposes. (2.x and 3.x
 would give the "correct" result even from ren abc*.* zzz*.*,
 but I broke myself of using it after spending half a day guessing
 at filenames after 5.0 truncated fifty or so sequential backup
 filenames on me in one fell swoop. Not cool. Not nice).

 "Up"grading to MS 5.0 broke every batfile I had, one way or
 another.

                              Don Hoffman

===============================================================================
25) REM

REM IN LINES WITH PIPES OR REDIRECTS

 ie: REM echo y | del *.*


EDITOR'S NOTE: Michael Scheper reported that he encountered
problems when he tried to REM out an "echo y|del *.*" line in
his batch file.


 ...when that batch file was executed, I ended up with the
 "All files will be deleted - are you sure?" message on my screen,
 until I saw it the next morning. It was actually piping "echo y"
 to "del *.*", which DOS didn't understand. It actually ended up
 hanging my entire system, probably because it was only expecting
 one character and not a whole line.

                              Michael Scheper


EDITOR'S NOTE: Here is the content of some of the responses
Michael received to his comment:


 Try:

              ::echo y|del *.*

 or even one ":" should do the trick. This just tells DOS that
 the line is a label, and should work without a hitch (unless you
 include a GOTO ECHO). Two ":" signs is the equivalent of a REM,
 but should eliminate the problem you mention above.

                              Gary Cooper


 It (the problem) appears to only occur if there is a pipe or
 redirection in the line (REM'd out), leading me to believe that
 DOS first handles pipes and redirections, then goes back to
 find out what to do with them.

                              John Mudge


 It's actually doing what it thinks you've told it: piping the
 output of REM to DEL. Since REM _has_ no output (remember
 REM > NULLFILE?), DEL hangs, waiting for the answer to its
 question.

                              Gary Smith


 What is happening here is that DOS reads the entire line, and
 always processes redirection and piping *first*, regardless of
 where they happen to appear.

                              Dennis Mccunney

===============================================================================
26) SWITCHES

EDITOR'S NOTE: The following commandline options are documented in
MS-DOS version 6.0+, some may have existed but were undocumented in
earlier versions.

SWITCHES=/W

 Enables you to have your WINA20 file anywhere on your boot
 drive. Without this you have to have it in the root directory.

                              Erik Ratcliffe


 You should also mention that this one should not be used with
 Windows 3.1. I've noticed a lot of people who do, and it wastes
 around 120K of UMBs.

                              George Hannah


 This is documented in DOS 6.0

                              Richard Pade


SWITCHES=/F

 Do you know that there is a rarely known switch called /F?
 If you put this line:

   SWITCHES=/F

 as the first line in your CONFIG.SYS, MS-DOS would not delay 2
 seconds, but immediately start processing your CONFIG.SYS. This
 trick has no other effects (AFAIK), but those who DO know better,
 correct me if I'm wrong!

                              Samuel Tan Yi Hsuen


 But where would you put the switch, it's not like you load a device
 driver that early in boot up do you?

 RF? Beats me. I think it goes in the SHELL= statement. Just don't
 RF? remember what character you use. I saw it mentioned in the
 RF? Tech conference /K maybe?

 No, it's SWITCHES=/F, right?

                              Paul Senechko 


 Actually, its both:

   /W allows you to move the WINA20.386 file
   /K makes your AT Keyboard act like a XT
   /F Disables the wait
   /N Disables F5/F8 exiting

 and to use any just put the command SWITCHES= and the parameters
 on the first line of your config.sys (Can go on other lines, but for
 the /F and /N you need it at the first line....), also the Switches
 command IS compatible w/ DOS 5, but only using the /W & /K options

                              John Guillory

===============================================================================
27) TRUENAME

 Internal DOS 5.0 command. Canonicalize a filename or path (using
 DOS interrupt 21h, function 60) prints the actual directory.

 SYNTAX

 TRUENAME filename      prints the complete path to file

 TRUENAME directory     prints the complete path to directory

 Note: If the path is in a network, it starts with a \\machine-name

                              Michael Larsson


 TRUENAME is analogous to the "whence" command in the UNIX Korn
 shell. It returns the real fully qualified pathname for a command.

 TRUENAME is useful in networks, where a physical drive may be mapped
 to a logical volume, and the user needs to know the physical location
 of the file. It ignores the DOS SUBST, and JOIN commands, or network
 MAPped drives.

 It is an undocumented MS/DOS feature, but is documented in 4DOS as
 follows:

   SYNTAX        (Internal DOS 5.0 / 4DOS)
 
   TRUENAME [d:][path]filename

   PURPOSE

   Returns a fully qualified filename.

   COMMENTS

   TRUENAME will see "through" JOIN and SUBST commands, and requires
   MS-DOS 3.0 or above.

   EXAMPLE

   The following command uses TRUENAME to get the true pathname for a
   file:

     c:\> subst d: c:\util\test
     c:\> truename d:\test.exe

     c:\util\test\test.exe

                              Dennis McCunney


 TRUENAME : will reveal the full name drive and path of the filename.
 If you specify a wildcard ('*') in the filename, it will expand
 the filename to use question marks instead. If the path includes
 the ..\ sequence, TRUENAME will examine the directory structure and
 calculate the path. Stranger still, the line:

   TRUENAME \CRONK\FLIBBET\..\ART
   produces the response:
   C:\CRONK\ART

 even if the directories \CRONK\FLIBBET and the file ART don't exist!
 Don't expect this command to work across networks.

                              PC Magazine #212 Pg. 48-49
                              Forwarded by:
                              Rodney Atkins


 I recently read a public message that said that there was an
 unpublished command in DOS called "TRUENAME". I went to the
 DOS prompt, and typed "truename /?", but all it said was
 "Reserved file Name"... I ran it once, and it gave me two
 extra prompts... any ideas?

                              Dan Knutson


 TRUENAME gives you the true path of file(s) forgetting any
 possible network re-direction, APPEND or SUBST.

 Try this: go into a directory where you have CHKDSK.EXE and
 type:

   TRUENAME CHKDSK.*

 You'll get something like C:\DOS\CHKDSK.EXE as an answer.

                              Raymond Paquin


 If you don't mind me asking, where did you find out about
 this command?

                              Dan Knutson


 Just by looking at COMMAND.COM with the Norton Commander file
 viewer. Near the end of COMMAND.COM, you can find a list of
 the internal DOS commands, and TRUENAME is right there at the
 end of it. Once I found it, I knew right off what it was probably
 for, so I tried it out after using the ASSIGN, SUBST, and JOIN
 commands, and it did exactly what I expected it to.

 ASSIGN redirects commands intended for one physical drive to
 another.

 SUBST redirects commands intended for one physical drive to a
 sub-directory on another drive (usually a hard drive). The
 sub-directory becomes a logical drive with the drive letter
 belonging to the drive being redirected.

 JOIN is the reverse of the SUBST command, and causes a physical
 drive to be addressed as if it were a sub-directory on another
 drive.

 Examples:

 ASSIGN A: B:       All commands (with a few exceptions) sent to
                    drive A: are now routed to B: instead. Drive
                    B: is still accessible as B: while this ASSIGN
                    command is in effect. Use ASSIGN with no
                    arguments to unASSIGN while not logged to the
                    ASSIGNed drive.

 SUBST A: C:\WORK   All commands (with a few exceptions) sent to
                    drive A: are now routed to the C:\WORK sub-
                    directory instead. The C:\WORK directory is
                    still accessible as C:\WORK while this SUBST
                    command is in effect. Use SUBST A: /D  to
                    unSUBST while not logged to the SUBSTituted
                    directory.

 JOIN A: C:\WORK    This command creates a logical sub-directory
                    named WORK in the root directory of drive C:,
 Use JOIN A: /D     but all commands sent to it (with a few
 to unJOIN while    exceptions) are routed to drive A: instead of
 not logged to      a sub-directory on the hard drive. In this
 the JOINed         example, any reference to the C:\WORK
 directory.         directory will actually access drive A:.
                    [Note: A JOINed sub-directory can only appear
                    at root directory level -- ie: a
                    JOIN A: C:\DIR1\DIR2 command won't work.
                    Also note that, in this example, the C:\WORK
                    directory must either be empty or non-existent
                    for the JOIN command to work. And finally,
                    while JOIN is in effect, drive A: in this
                    example is NOT accessible as A: until JOIN
                    is terminated.]

 In the first two cases, "TRUENAME A:" will return "B:/" and "C:/WORK"
 respectively. In the latter, "TRUENAME C:\WORK" will return "A:\".

 Other DOS commands that should NOT be used on a drive that is the
 subject of an ASSIGN command include: SUBST, JOIN, BACKUP, LABEL,
 PRINT, RESTORE. Furthermore, DISKCOMP, DISKCOPY, and FORMAT ignore
 the effects of the ASSIGN command and work on the drive specified
 in the command used. [Note: FORMAT calls LABEL when it finishes
 formatting, so you can't use FORMAT anyway.]

 Other DOS commands that should NOT be used on a drive that is the
 subject of a SUBST or JOIN command include: BACKUP, CHKDSK, DISKCOMP,
 DISKCOPY, FDISK, FORMAT, LABEL, RECOVER, RESTORE, and SYS.

 The same applies to any other utilities that work with physical
 drives instead of logical DOS drives, such as several of the
 Norton Utilities. Don't use something like DISK DOCTOR (NDD)
 on an ASSIGNed, SUBSTituted, or JOINed drive/directory.

                              Paul Maserang


 ...Sounds as if it could be handy when you know a filename,
 but forgot what directory it was in; could save searching a
 whole drive for it...

                              Don Kimberlin
 

 If you use subst to re-define a directory as a drive, truename
 returns the real drive and path, not the drive letter provided
 by subst. The original example given for truename filename
 assumes that you are already in the directory where the file
 is located. As a matter of fact, if you issue the command

   truename foo.bar
 
 and foo.bar does not exist in the current directory, truename
 will return the true path followed by foo.bar...Try it and see
 for yourself.

                              Bill Mitchell


 Actually, with DOS 5 here, the /? works just fine, and describes
 what it is.

   C:\WINDOWS>truename /?

 Returns a fully qualified filename.

   TRUENAME [drive:][path]filename

 TRUENAME will see through JOIN and SUBST commands. It requires
 DOS 3.0 or later.

 The above was with DOS 5 and NDos from Symantec.

                              Cy Welch


 That's because of NDOS. With COMMAND.COM from DOS 5.0, the /?
 switch gives "Reserved command name."

                              Gary Smith

===============================================================================
28) VER

VER/R

 Yields extended information about the OS Version. IE:

   MS-DOS Version 5.00
   Revision A
   DOS is in HMA

                              Billy Gilbreath


 Doesn't work with DOS 3.30

                              Mitch Ames

===============================================================================
29) %0

 Note that %0 is (almost) always defined as the name of the batch file
 itself (including drive\directory as typed at the command line). The
 only time %0 is not defined is in Autoexec.bat when run by
 Command.com at boot time (or command/p).

                              Mitch Ames


 The %0 parameter is the name of the program. But wait, there's
 more. If you want to test for the name of the program you are in!
 What do your want to test for?

 One time you type "edit", another you type "EDIT", another "EDIT.BAT",
 another "C:EDIT.BAT", and another "C:\BELFRY\EDIT.BAT". How many
 combinations do you want to test for at the start of your batch file?

 You can map the file name to upper case and take care of some of the
 problem as follows:

   SET SAVEPATH=%PATH%
   PATH %0
   SET PROGNAME=%PATH%
   PATH %SAVEPATH%
   SET SAVEPATH=

 To do the test, something like this might work:

   FOR %%E IN (EDIT EDIT.BAT C:EDIT C:EDIT.BAT C:\BELFRY\EDIT...
       ...C:\BELFRY\EDIT.BAT) DO IF '%%E'=='%PROGNAME%' GOTO HIT
   ECHO BAD COMMAND OR FILE NAME
   GOTO ENDIT
   ...
   :HIT
   REM START EXECUTION HERE....

 There is one last gotcha to %0. When AUTOEXEC.BAT is run by the bootup
 sequence, %0 has no value. This is important if you want to find out if
 you are in AUTOEXEC.BAT, and if you are in AUTOEXEC.BAT for the first
 time.

 I have seen this work with IBM's PC-DOS 3.10, various flavors of
 MS-DOS 3.10, 3.30, 3.31, 4.01, and 5.00. It also seems to work
 with DR-DOS 6.0. As to 4DOS, I have no idea, but would welcome
 feedback on the matter (although 4DOS and DR-DOS hardly qualify
 for a MUF entry....)

                              Mike Avery


 So far as I know, it's not been documented anywhere 'officially',
 but I did read about it in an article sometime back, probably
 either in PC Magazine or in PC Computing.

                              Gary Smith


 I've never seen it documented - it just bit me one day REAL HARD!
     
 Well, the way I figured it was that when the boot process hands control
 to AUTOEXEC.BAT, the normal command line interface isn't used, so %0
 never gets set.

                              Mike Avery


 This feature can actually be useful, because you can put
 statements like this in your autoexec:

   if NOT (%0) == () goto skip
   [statements that should not be re-executed go here]
   :skip
   [statements that can be re-executed go here]
   path...
   set...
   etc.

 Then you can recreate your bootup environment at any time by
 simply typing AUTOEXEC.

                              Gary Smith

===============================================================================
           Other interesting information for MUF Explorers!!!
===============================================================================
30) ANSI

 Anybody who knows what

   DEVICE=ANSI.SYS /SCREENSIZE
                    -----------
 means?

                              Karsten Weldingh


 Well, first off, I don't know what it means.

 But it certainly does exist. The HELP file in DOS 6.2 lists only
 the /X /K and /R parameters.

 But dumping the contents of ANSI.SYS reveals that the strings
 /SCREENSIZE, /S, and /L are also present.

 What they do is another question. I could certainly imagine that
 ANSI would have every right to know what the screen size was. In
 fact it couldn't function without knowing. But I haven't a clue
 what the switch does.

 Normally I don't answer questions just to say "beats me", but I
 didn't see any other responses yet, and thought I'd at least tell
 you that you weren't dealing with some oddball variant ANSI.SYS.

                              Gary Novosielski


EDITOR'S NOTE: John Gray asked:

 Does anyone know if DOS keeps a record of the drive (probably drive
 number) from where it was booted?

                              John Gray


 "Undocumented DOS" says it is at offset+43h in the List of Lists in
 DOS 4.0 and subsequent  (1=A:). To get the LoL you do

   mov ah,52h
   int 21h

 The pointer to the List of Lists is returned in es:bx.

                              Bob Stephan

===============================================================================
31) DBLSPACE and RAMDRIVE

 I have recently bumped up against a problem with the way I want to
 use DBLSPACE and RAMDRIVE (obviously DOS 6). It started with an
 article in PC Computing (Oct 93, p.301) that detailed how to
 DBLSPACE a RAM drive. I tried it, and it worked fine, until I
 rebooted. To DBLSPACE the RAM drive, you have to place the commands
 that create and resize it in AUTOEXEC.BAT, meaning that you have to
 explicitly state the drive letter of the RAM drive and the compressed
 volume that DBLSPACE creates. When I booted, RAMDRIVE.SYS used the
 next letter up from what it was before (it was K:, now it was L:).
 I went through all the steps again, and when I finished, the RAM
 drive was up to M:! After a half hour of checking all my setups,
 I finally realized that DBLSPACE reserves all drive letters up to
 the highest one you have used. Since in the first iteration, the
 highest drive letter I DBLSPACEd was K:, DBLSPACE reserved K: when
 it is loaded in CONFIG.SYS. Since my call to RAMDRIVE.SYS came
 after this, it used the next available drive, L:. I found the menu
 in DBLSPACE that sets the maximum drive letter, but this is not a
 permanent setting. If I went through the steps above again, I
 would be chasing increasing drive letters again.

 I can fix this obviously by swapping the order of the two calls, but
 I thought this may be of interest to anyone having similar problems.

                              Greg Frizzle

===============================================================================
32) ECHO

ECHO Y|FORMAT C:\*.*

EDITOR'S NOTE: In response to a suggestion to use "Echo Y|FORMAT
C:\*.*" the following Undocumented switch was suggested:

FORMAT /X

 You forgot to add the /X for formatting a fixed drive.

                              Clint Satterwhite


 What is /X for? I know about /H and /AUTOTEST, is this another
 version of it?

                              George Steinmetz

===============================================================================
33) EDIT

Here is some additional information about MS-DOS's EDIT program
which may not technically qualify as a MUF, but they do qualify
as obscure features:

 [MS-DOS Edit]

   Save changes and exit     Do NOT save changes and exit
   -+--+--+--+--+--+--+-     -+--+--+--+--+--+--+--+--+--
   [Alt]                     [Alt]
   [Up][Up]                  [Up][Up]
   [Enter][Enter]            [Tab][Enter]

                              Vernon Frazee


   Quit EDIT w/o saving: [Alt][Up][Up][Enter][Tab][Enter]

 Something special: EDIT provides the usage of BOOKMARKS.
 
   Key-bindings (German Version): Ctrl-K 0-3   Set Bookmark x to 4
                                  Ctrl-Q 0-3   Goto Bookmark x of 4

 Very useful when editing large files.

                              Michael Dehlwes


 It SEEMS that MS has put out a new EDIT. I've often had a
 problem because I've wanted to edit large files, and EDIT
 (EDIT.COM  413  3-10-93  6:00) couldn't handle them. I found
 EDIT ver. 0.9.019 on a BBS, virus scanned it, and have started
 to use it. It is: EDIT.EXE (note .EXE not .COM), very large
 (69,662), but handles files of AT LEAST 2.5 MEG. It's been
 great for me. Other info: 10-17-94  0:00 (Is the 0:00 indicative
 of beta version?) "Help, About" says it's MS-DOS EDITOR 0.9.019
 copyright MS Corp 1994. Anyone know more about it?

 I tried the ctrl-p ctrl-g for beeping in this editor:

 Edit.exe won't allow a ctrl-P! (It beeps!) The ctrl-p ctrl-g
 only works with EDIT.COM.

 Interestingly, once I've put the beep into a bat file EDIT.COM,
 when I call up the bat file with the new EDIT.EXE, the "large
 period" IS there, and can be deleted, moved, copied... just like
 any other character.

 Search-and-Replace only does a Replace All for lines AFTER the one
 the cursor is on (in the new EDIT.EXE), unlike the Change All
 operation in the original edit.com, which makes the change
 EVERYWHERE in the document.

                              Avi Tuchman

===============================================================================
34) EMM386.EXE

 Windows in enhanced mode an error is generated stating my
 EMM386 is in an invalid path. It's looking for the EMM386
 in the A: drive (boot ROM).

                              Andrew Baker


 To get around this problem, place the correct version of
 EMM386.EXE into a directory which is accessible by all users.

 Then in your CONFIG.SYS for your remote boot image include a
 statement similar to the following:

   DEVICE=EMM386.EXE 512 RAM /y=R:\WINDIR\EMM386.EXE

 The /y option is an undocumented switch!

                              James Willmott

===============================================================================
35) FIND

 Can someone tell me how one might test for case sensitivity under
 4DOS? If I do the following:

   if abc==ABC echo yes

   if "abc"=="ABC" echo yes

                              Troy Prather


 I would probably try to make a batch file solution for this. FIND
 is case sensitive and returns an errorlevel (undocumented feature).
 Not purely a 4/Ndos solution but then, not a solution at all, but a
 clue.

                              James Mcgill


 ...pipe the output from your FIND to another FIND.

                              Jack Stein


 It works, but it's dangerous if the files are huge-enough
 to possibly exhaust space in %temp%... DOS may just quietly
 lose the entire interim i/o w/o giving any indication at all.

                              Don Hoffman


 DOS failure. Discovered in MS 5.0 rev A (upgrade); no others
 checked. "Undocumented Function" in the sense that DOS is doing
 something (highly improper) which, to the best of my knowledge,
 is documented nowhere. Species: BUG.

 Short Form: "Piped files may prematurely disappear without warning."

 Long Form: During 'piping' an "OUT-OF-DISKSPACE" condition may go
 completely un-acknowledged by DOS, to either the user, or to the
 active program. DOS just quietly "loses it."

 Example:
 ~~~~~~~
   PKUNZIP -C bigfile *.txt|FIND "keyword"|SORT|LIST/s

 Now the above should extract/decompress and concatenate all *.TXT
 files from BIGFILE.ZIP and route that output to the CONSOLE, which
 (in this example) is re-directed to the DOS FIND program, etc, via
 automatic "pipe" files.

 However, this example MAY FAIL at the UNZIP step due to full-disk
 yet generate *NO* diagnostics or error message WHATSOEVER. Nor will
 DOS necessarily return an "out-of-diskspace" (or any other error
 indication) to the program which caused it. (PKUNZIP in this example.)

 The subsequent program steps will *appear* to execute normally,
 but in actuality they are receiving *NO* *INPUT*!

 Hence, in the absence of final-step output, it is *NOT* possible
 to tell whether the source material contained no targeted 'hits',
 or whether the _intermediate_ data simply grew so large that it
 exhausted all diskspace, and was silently discarded / deleted by
 DOS.

 remarks: "erratic"
           ~~~~~~~
 1) Sometimes it returns an 'out-of-diskspace' indication to
    the program doing the output, sometimes it doesn't.

    (Tested with INT 21h/function 40h: "Write to File/Device".)

 2) Also seems to behave differently depending on whether or
    not the TEMP environmental variable is properly defined, and
    what media (RAM or regular disk) is involved.

    (TEMP is a specifier/keyword to DOS, telling him where to put
    his temporary work files. If undefined/invalid, he will use
    the 'current' drive / directory.)

 3) UNDELETE can't give any useful information (if more than two
    pipes are used,) as each successive step overwrites the FAT
    entry of the preceding step; (Size field in particular.)

 4) Reiterating: comprehensive tests were *not* carried-out once
    the erratic nature became apparent.

                              Don Hoffman

===============================================================================
36) GENERATING RANDOM FILENAMES

EDITOR'S NOTE: In response to a question from Kyle Brost requesting
a method of generating random filenames using DOS, Mitch Ames offered
the following pure DOS solution.

 I was looking for a line in a batch program that would give a
 random name or set of numbers to a variable which would then make
 a directory.

   IE.  %1=random name
        MD\%1
        CD\%1

                              Kyle Brost


 You can make vanilla DOS generate a filename with a random name and
 no extension by piping. This filename can then be fed into an EV.
 Eg (:: has the same effect as REM)

   :: RANDOM.BAT
   :: create temporary dir (which will be empty)
   md tempdir
   :: tell DOS to put temp files there (saving old %temp%)
   set org_temp=%temp%
   set temp=tempdir
   :: now pipe a CR to copy. This will create a non-zero length
   :: file with no extension (*.) which will be copied as *.rnd
   echo. | copy %temp%\*. %temp%\*.rnd
   :: DOS will delete its temp files (*.) but _not_ the copies.
   :: Change to the temp dir so that FOR command will not include
   :: the directory in its variable
   cd %temp%
   :: remove the extension
   ren *.rnd *.
   :: now set a variable to the filename
   for %%r in (*.) do set random=%%r
   :: back to the original directory, delete the temp dir and
   :: restore %temp%
   cd ..
   del %temp%\*.rnd
   rd %temp%
   set temp=%org_temp%
   :: And show the results
   echo %random%
   :: Create a directory, and change to it
   md %random%
   cd %random%

 I've tested RANDOM.BAT with DOS 5 and it seems to work OK. However
 here are a few problems you might encounter.

 This won't work with 4DOS because it generates temp files with
 different names (eg P1.$02), and the FOR IN (/SOMETHING) trick
 doesn't work properly. But if you use 4DOS you don't need all this
 stuff anyway - see the next message.

 Filenames generated by piping have a different format in different
 versions of DOS. 5 seems to use any letters, whereas 3.30 uses
 only hex characters (0-9, A-F).

 DOS 3.30 does not seem to use the %temp% variable and always puts
 temp files in the root directory of the current drive. There may be
 other (than temp) files with nul extensions in the root.

                              Mitch Ames

===============================================================================
37) HIMEM

 I keep on trying to install my himem.sys in my config.sys file so
 that I can run different utilities that require it but every time I
 reboot after I put the line in, it locks up.

                              Dana Harding


 ...try entering HELP HIMEM.SYS and reading all the online help.
 Pay particular attention to loading sequence, and the switch option:
 /MEMCHECK

                              Bat Lang


 In the HELP I also noticed /Module, and this could occasionally
 be useful, and quite some time ago I found /Page, very shamefacedly,
 since for weeks I had cursed M$ when all the output from /Classify
 had scrolled off the top of the screen, and I had forgotten to use
 the MORE filter...!

                              John Gray 

===============================================================================
38) IF

DOES A DRIVE EXIST?

 I've just been playing around, and managed to come up with a way
 to do it (check to see if a drive exists) in a batch file.

 Just try to change to that drive, and DOS will return a non-zero
 errorlevel if the drive does not exist.

   Z:
   If Not ErrorLevel 1 GoTo End
   Echo Sorry, Drive Z: does not exist.
   :End

 This will work with MS-DOS 6.20. Can't say for other versions of
 DOS, as I've only tried it on 6.20.

                              Matthew Lewis

===============================================================================
39) IF ERRORLEVEL

 In a discussion regarding the correct syntax for:

   IF ERRORLEVEL n GOTO LABEL

  Vs.

   IF ERRORLEVEL == n GOTO LABEL

 Gary Smith had this to say to Robert Clark:

 Actually, although the second form works, it really isn't legal,
 and it's definitely undesirable...

                              Gary Smith


 Sure it's legal. It's simply a matter of preference and/or style,
 which wasn't the question. The fact is, _either_ construct
 performs the same under MS-DOS--so a person may use the one that
 makes more sense to him at the time. FWIW, I prefer to leave the
 equality sign out, but only because it means less typing for me.
 <G>

                              Robert Clark


 Depends on your definition, I guess. Of course it's legal in 
 the sense that there's no law against it, but it's not part of 
 the documented syntax and it works more by accident than by 
 design. The reason I dislike it is because "==" generally means
 "is equal to" and that is NOT how IF ERRORLEVEL works. I see no 
 point in writing intentionally misleading statements, even in 
 batch files.

                              Gary Smith


 It does NOT display each errorlevel equal to or below, and that's
 because I use if errorlevel == x (note the two equal signs).
 Try it! At least I don't get more than one answer for errorlevels
 like eight, under DOS 6.20.

                              Jonas Anden

===============================================================================
40) INTERLNK

 I have a tip for Dos 6 users. I have a "no name" brand fax modem
 card which has been working fine. I have logged onto many BBS's &
 downloaded many megs of files & messages over past couple of weeks.
 Today however I decided to upload a file (what a novel concept!!)
 I run Telix, but the same happened under Terminate.

 After selecting Z modem as the protocol, the file directory appears,
 at which point the modem card hangs up the line Every Time. The
 culprit was the Dos command INTERLNK which I had installed 2 weeks
 ago. I had it set up on the parallel port so why it was effecting
 the comms port is a mystery. Even using the following parameters
 had no effect.

   DEVICE=C:\DOS\interlnk.exe /LPT:2 /Noscan /V

 Hope this saves someone the many hours it cost me.

                              Tony Nolan
                              Information forwarded by Gerry Pareja

===============================================================================
41) LABEL

:LABEL

 DOS uses a leading : to indicate a label. If the next character
 following the : is a space or other non-alphanumeric char, DOS
 will decide it's an invalid label and skip to the next line,
 performing no further action.

                              Dennis Mccunney


 A colon followed by a space is exactly the same to DOS as ::, and
 will *never* be seen as a label.

                              Bat Lang



EDITOR'S NOTE: Spaces between the colon and the first character of
the label are permitted in newer versions of MS-DOS but were
interpreted as invalid labels in earlier versions.



 Give the following simple example a try:

   @echo off
   goto LABEL
   goto END
   :                       LABEL
   echo This is ":                       LABEL"
   :END

                              Vernon Frazee


 Here's what Microsoft has to say on the subject:

   GOTO--Note

   Valid values for label

   The label parameter cannot include separators such as spaces,
   semicolons or equal signs

   GOTO uses the first eight characters of each label

   The GOTO command uses only the first eight characters of a label.
   Therefore the labels "hithere01" and "hithere02" are both
   equivalent to "hithere0"

   Matching the label parameter with the label in the batch program

   The label value you specify on the GOTO command line must match a
   label in the batch program. The label within the batch program must
   be preceded by a colon.

   If your batch program does not contain the label that you specify,
   the batch program stops and MS-DOS displays the following message:

     Label not found

   MS-DOS recognizes a batch-program line beginning with a colon (:) as
   a label and does not process it as a command. If a line begins with
   a colon, MS-DOS ignores any commands on that line.

                              Forwarded by Matthew Lewis



  Both DM and I were guilty of applying yesterday's truths to today's
  world. Apparently DOS 6 changed all of this, and neither one of us
  caught it. We stand corrected.

  In mitigation, however, I wonder how one is to learn of this, given the
  documentation available; without finding out either in here, or thru
  experimentation?

  Although I have the last sizeable reference manual for DOS (5.0) it
  has even less on the use of labels.

  As a minimum, LABEL in MUF17 will require a qualifier, for applying
  only to versions earlier than 6.0.

                              Bat Lang


 What it should have said, and didn't, is that spaces between the
 colon and the first character of the label are ignored.

                              Gary Smith


 Can anyone find a version of MS/PC-DOS where a blank after a colon
 and before a 'word' causes this NOT to be accepted as a label?
 If not, I think my contention, that comments in BATch files are best
 preceded by *two* colons, must stand.

                              John Gray


 That DOS 2.1, as I recall, did not accept a blank after the colon.
 Unfortunately I can no longer verify this vital fact. <g> If I get
 a chance to try it on 3.3, I'll let you know what happens.

                              Gary Smith


 I just booted a 2.x (OEM-tweaked MS 2.0) in the background and
 checked: "Label not found" (and immediate termination of the batch
 file) if a blank follows the colon. (Tried "::label" too while I
 was at it... Identical response;)

                              Don Hoffman


 Place 2 "::" in front of the line you wish to skip. DOS handles it
 as a label, thus, doesn't try to execute it; it is faster.

   ::device=mouse.sys

                              Frank Starns


 Only in AUTOEXEC.BAT, Frank; in CONFIG.SYS, DOS still gives the
 "unrecognized command" error message.

 Use ";" instead. DOS will ignore the line and not spit out an
 error message.

                              Ron Warder

===============================================================================
42) MODE

COMMAS IN FILE SIZE:

   mode co40
   dir/-p %2|find "bytes free">>magic.bat
   mode co80

                              Larry Nelson


 Why change video modes?

 I cut out the two `mode' lines and it still works great,
 speeding operation a little and saving wear and tear on the
 monitor.

                              Dennis Rush


 That Mode thing is a trick that Vernon Frazee came up with
 to beat the commas that DOS6+ puts in file size values. For
 some odd reason Vernon took a look at a directory listing
 while in mode co40 and realized that there were no commas
 in the numbers. Who *ever* looked at anything in mode co40?
 Vernon has a lot of idle time.

   Mode co80
   MAIL                33,474 07-11-95   7:02p
     1 file(s)         33,474 bytes
                  155,590,656 bytes free
   Mode co40
   MAIL             33474 07-11-95   7:02p
     1 file(s)      33474 bytes
                155590656 bytes free
      
 Command.com sees 33,474 as 33 474 the comma is seen as a space.
 It looks nice but screwed up a lot of Batch files.

 If the batch works OK for you then you must be running an older
 version of DOS.

 I ran into the same prob with Cache.bat below, but the Mode trick
 doesn't seem to work for anything but Dir. I managed to whip it
 with the lines....

   echo if %%4 == cache set hit=%%3 >there.bat
   echo if not %%4 == cache set hit=%%3%%4 >>there.bat
   echo if %%2 == cache set mis=%%1 >and.bat
   echo if not %%2 == cache set mis=%%1%%2 >>and.bat

                              Larry Nelson


 Type the following command and note how it strips the ".ext"
 
   MODE filename.ext

                              Vernon Frazee


 For those who haven't tried this, the result is
 
   Invalid parameter - filename

 with the unusual property that it can be redirected (usually
 error messages cannot be). You could then use the magic-named
 batch file Invalid.bat to process parameter %3 as filename.

                              William Lipp


EDITOR'S NOTE: For those reader's unfamiliar with the "magic-named
batch file" which William suggests above with INVALID.BAT, here is
a sample MS-DOS magic batch which creates "Current.bat" on the fly,
and is used in this example with DATE and TIME. Conversion to
INVALID.BAT is left to Larry Nelson in his response to Chris Weisner
below. I credit Rudy Lacchin of the BatPower echo with the development
of the "magic named" technique, as in the following magic
Current.bat which I adapted from Rudy's method.

 @ECHO OFF
 CD\DOS
 VER|DATE|FIND "Current" > TEMP.BAT
 ECHO SET DATENOW=%%4 > CURRENT.BAT
 CALL TEMP
 ECHO ͻ > DBOX.TXT
 ECHO                                         >> DBOX.TXT
 ECHO           Date = %DATENOW%            >> DBOX.TXT
 DEL TEMP.BAT
 DEL CURRENT.BAT
 SET DATENOW=
 VER|TIME|FIND "Current" > TEMP.BAT
 ECHO SET TIMENOW=%%3 > CURRENT.BAT
 CALL TEMP
 ECHO           Time = %TIMENOW%           >> DBOX.TXT
 ECHO                                         >> DBOX.TXT
 ECHO ͼ >> DBOX.TXT
 DEL TEMP.BAT
 DEL CURRENT.BAT
 SET TIME=
 CLS
 TYPE DBOX.TXT
 DEL DBOX.TXT
 CD\
                              Gary Cooper


IE: Subject: FILENAME PARSING

 I'm wondering if anyone has come up with a way to parse filenames
 and extensions. I'm trying to convert subdirectories on the fly
 from .xxx to .yyy, however using DOS  FOR %%a in (*.xxx) do...
 always provides the complete filename. I'm looking for a way to
 strip the extension. Speed is not an issue.

                              Chris Wiesner


 An obscure quark of the DOS Mode command, made known to us at BatPower
 by one Vernon Frazee, solves the unwanted extension problem. When Mode
 is called with a file name as a parameter (say TST.bat) it returns an
 error message.

   Invalid parameter - tst

 It would appear that Mode chokes on anything not a standard Mode
 parameter and if you will notice, the name of the file typed in
 returns less .ext. This little bit of strangeness proves to be
 fodder for a Magic.bat which can commit the newly stripped
 filename to an envar where you can use it at will in your Batch
 file. In X10.bat below I simply echoed the file name to the screen.
 Kill the "set name=" line and the envar will stay in your DOS
 environment until you reboot. That way other .bats can use it.
      
 @echo off
 cls
   if %1! == ! goto hlp
   mode %1>magic.bat
  echo set name=%%3>invalid.bat
   call magic
  echo %name%
 :cleanup
   for %%q in (invalid magic) do del %%q.bat
   set name=
   goto L8r
 :hlp
   echo                    SYNTAX = x10 (filename.ext)
 :L8r

                              Larry Nelson

===============================================================================
43) PAUSE

    Have you tried using PAUSE `` instead of PAUSE > nul

                              Ron Dempsey

===============================================================================
44) SET

EDITOR'S NOTE: This section contains information about the
undocumented use of high ASCII characters in environmental
variables, but note also the use of LABELs and the fact that DOS
does not recognize the "=" characters in the labels used. Note
also that John discusses the possibility of two consecutive ";"
symbols occurring in the PATH statement. This possibility was
discussed earlier in the MUF list.


 Those who were interested in the ADDPATH.BAT by Rob Flor and my
 subsequent ADD2PATH.BAT and DROPPATH.BAT posted some time back might
 like to compare them with this PCMag BATch file called PE.BAT, which
 I found in a file of PCMAG files. Note that the original character
 which I have replaced by '@' was the 1/4 symbol in code page 437,
 hex AC, dec 172. You didn't know you could put

   SET <one or more characters above hex 7F>=SOMETHING

 and get a valid environment variable from this? Neither did I!
 Note the recursive calls and about the only use of SHIFT I have
 ever seen in a practical BATch file. There are a few things I
 would want to improve, for adding: check the directory isn't
 already in the path, not putting two semicolons when adding to
 the end of the path if there was one already there at the end,
 check there is enough environment space to hold everything...
 and for deleting: check whether the path is already empty. In
 fact, many of the comments in ADD2PATH and DROPPATH apply! That
 said, it is an interesting and useful BATch file.

   @ECHO OFF
   :PE.BAT - Path Editor. Add or remove directories
   IF '%2'==''  GOTO Help
   IF '%1'=='+' GOTO AddEnd
   IF '%1'=='&' GOTO AddBegin
   IF '%1'=='-' GOTO Drop
   IF '%1'=='@' GOTO DoDrop
   GOTO Help

   :===== AddEnd ========
   PATH=%PATH%;%2
   ECHO %2 added at end of path.
   GOTO End

   :===== AddBegin ======
   PATH=%2;%PATH%
   ECHO %2 added at beginning of path.
   GOTO End

   :===== Drop ==========
   SET @=%PATH%
   PATH=%2
   SET PE_drop=%path%
   :: Now variable drop contains %2 capitalized
   PATH=%@%
   SET @=
   SET PE_rem=
   :: Restart, passing PATH as parameters
   %0 @ %PATH%

   :===== DoDrop ========
   SET PATH=
   :==  DropLoop
   SHIFT
   IF '%1'=='' GOTO DoneDrop
   IF '%1'=='%PE_drop%' GOTO DidRemove
   IF '%PATH%'=='' PATH=%1
   IF '%PATH%'=='%1' GOTO DropLoop
   PATH=%PATH%;%1
   GOTO DropLoop
   :==  DidRemove
   SET PE_rem=YES
   GOTO DropLoop

   :===== DoneDrop ======
   IF '%PE_rem%'=='' ECHO %PE_drop% not found
   IF '%PE_rem%'=='YES' ECHO %PE_drop% removed from path
   SET PE_drop=
   SET PE_rem=
   GOTO End

   :===== Help ==========
   ECHO The options are:
   ECHO %0 + directory : adds directory at end of path
   ECHO %0 & directory : adds directory at start of path
   ECHO %0 - directory : drops directory from path
   ECHO Note that the PATH must not be empty.
   :===== End ===========
   PATH

   ### ends

                              John Gray

===============================================================================
45) SETUP

SETUP /G  (possibly /E)

 When installing MS-DOS 6.0, does not ask you for a blank, formatted
 disk to restore the old DOS version from.

                              Alex Cohen

===============================================================================
46) SWITCHES

 Anybody with any ideas what the /T-switch, like

   SWITCHES=/T

 does? It doesn't give any errors when used.

                              Karsten Weldingh

===============================================================================
47) %TEMP%

EDITOR'S NOTE: In a discussion about manipulating ASCII text
files the following was overheard:


 But, doesn't DOS have to write the file somewhere anyway, as
 it isn't clever enough to run a pipe otherwise... you have to
 have say 100k of disk free if your file expands to 100k even
 if you don't actually "see" the temporary intermediate file?

                              Robert Bull


 You are 100% correct about this restriction/problem! In
 fact I've (painfully) discovered that DOS will often give
 NO INDICATION that diskspace is exhausted (in %temp%, or
 wherever) to either the User, or to the Program which is
 writing the redirected/piped output.

 (My LOCATE v 3.x [8086 Assembler] does ALL output via
 File-Writes [and] can tell when his CON output is redirected
 /piped, but NOTHING I/he can test is 100% guaranteed that
 he hasn't run out of PipeSpace)-;

 (Apparently some DOS's just route any/all pipe overflow to
 nul, and give NO error indication whatsoever!!)

                              Don Hoffman

===============================================================================
48) XCOPY

 I'm having a problem. I seem to find that XCOPY does not return
 an errorlevel 1 when there are no files to copy. Is this my
 imagination or am I doing something wrong?

   if errorlevel 1 goto nofiles
   if errorlevel 0 goto found

                              Greg Miskelly


 I tested these two error levels using xcopy and it seems that
 the errorlevel 0 will work fine if there are files with the
 archive attribute set. I removed the archive attribute and I
 do not get the errorlevel 1 unless I try to use xcopy on an
 "empty" directory and then it becomes the "no files to copy"
 errorlevel. Strange or else that is MS DOS's definition of
 "no files found to copy". It seems to me that if no files are
 "set" for xcopy to copy then there is no errorlevel for that.
 Bad news.

                              Gary E. Brooks


 Just discovered something that may help. XCOPY *does* return
 an errorlevel of 1 when there are no files to copy. But it
 means that there are NO files in the specified directory NOT
 that there are no files meeting the specified criteria ie, no
 files with the archive attribute set.

 Methinks that's its not explained properly in the help file!

                              John Black


 After much experimentation with MSDOS 6.20 (english) and 6.00
 (german), I've discovered that XCOPY will return an errorlevel
 of 1 only if the source file(s) don't exist.

 Up until now I'd assumed, like you, that (with the /m or /a
 switch) "No files found to copy" meant "No files with archive
 attribute found". Looks like a bug to me. :-(

 Since version 6.00, XCOPY will not copy files with the system
 or hidden attribute, so it doesn't matter whether the archive
 attribute is set or not.

                              John Evans


 With 6.2, I've also experienced some problems with Xcopy
 errorlevels. No difficulties with earlier versions, tho.
 One bat file in particular really irritated me and I ended
 up having to do a work around, because xcopy just wouldn't
 cooperate. I suspect there may be a baby bug in v6.2.

                              Brice Vineyard


 Use the following to see if XCOPY is even returning an errorlevel
 (I'd almost bet it isn't):

 To All - Vernon Supplied a Batch File ERRLVL.BAT to examine errorlevels
          returned by programs.

                              Vernon Frazee


 You were right, below is a screen copy of the result:

   C:\>errlvl xcopy *.* d:\*.* /m /s
           0 file(s) copied
   Errorlevel 0
   C:\>_

 I tested it on a quick format of a write protected double
 density diskette, ie:

   C:\>errlvl format a: /u /q /f:720 /v:greg
                 !
     (screen garbage deleted for brevity)
                 !
   Errorlevel 4
   C:\>_

                              Greg Miskelly

===============================================================================
49) ZERO-BYTE FLAG FILES

EDITOR'S NOTE: During a discussion about the use of flag files,
Bruce Bowman suggested the following command to produce a zero
byte file:


  REM>TEMP$$.DAT

                              Bruce Bowman


 I read in the DOS manual that you are not supposed to use
 redirection or pipe commands inside of a batch file. Does
 the "REM" nullify this restriction?

                              Yannick Leclerc


 I can't imagine why your DOS manual would say that. I do it
 all the time!

 The REM command in this case merely creates a zero-byte flag
 file called TEMP$$.DAT.

                              Bruce Bowman


 The point is that not many people want 0 byte files on their
 h/d so the advice given by the manual is for once spot on.

                              Ian Underwood


 Yes, but what if you DO want one? I use this trick to create
 flag files, and have the same batch file delete them later
 (as demonstrated). 0-byte files are better for this, since
 they take up only the room in the FAT. A 1-byte file takes
 up a whole sector.

 I don't think the *manual* should say something shouldn't
 be done just because some people don't pay attention to what
 they do!

                              Bruce Bowman


 Perhaps he may have been thinking of the CALL command, about
 which I have seen such a note made in a DOS text:

  Note: The CALL command should not be used with piping or
  redirection

                              Bat Lang


 Give the man (Yanick Leclerc) a star, he reads the manual! :)

 Check that section again, it's not always apparent what they mean
 on first reading (a reference manual must be unambiguous; not easy
 to follow).

 You aren't supposed to redirect or pipe batch files.

  ie:

    MYBAT.BAT > MY.LOG

  or

    CRASH.BAT |BURN.BAT

 Batch commands can be redirected and piped.

    OK.BAT
    VER |TIME |FIND "Current" >>BOOT.LOG

                              Rob Flor


 I am in need of updating the time stamps on two 0 byte files.
 I tried using " COPY /b F?RESCAN.NOW+,, " as that was the suggested
 way to update time stamps, but I guess since they are 0 bytes in
 size it just deleted them.

                              Dennis Morgan


 How about using this instead of copy.

  REM >>FILENAME.EXT

 This still leaves it a 0 byte file but updates the date and time on it.

                              Tony Baechler

===============================================================================
EDITOR'S NOTE:  Also overheard:


 There are two entries in the list of commands in IO.SYS that I've
 never seen explained:  MULTITRACK and FHSTDIC. They're presumably
 used in Config.sys.

                              Shakib Otaqui


 In MUF I missed COMMENT (DOS 5 & 6) and MULTITRACK (6).

                                Richard Pade


EDITOR'S NOTE: In another message from Bill Foster to Chris Kuefler
re: Subj: undocumented DOS commands, the following was overheard...

 If you could supply me with a BBS number that has the file online,
 or, even better, a BBS that has it available for FREQ it would be
 greatly appreciated.

                              Chris Kuefler


   Sure...how about Odyssey Systems - (905) 579-9241 for the
   regular BBS lines - located in Oshawa, Ontario.

   You can also try Freq'ing DOS56UN.ZIP  21k  01-14-94 from 
   Odyssey Systems at 1:229/434 - listed nodes only!

                               Bill Foster

===============================================================================
EDITOR'S NOTE:  "Without prejudice" (For any lawyer's out
there). I have not seen the file DOS56UN.ZIP mentioned above, nor
it's contents. However, I have seen at least one hacked version
of the MUF(c) list. I would appreciate it, if the MUF(c) list, as
I have distributed via BatPower, would remain "in it's entirety".

I have noted some magazines, with feature articles including
"hauntingly familiar" information. ;-) The articles mention that
the author has "discovered" a new feature and proceeds to give
several examples of the feature's use, also "hauntingly familiar".

I, for one, would appreciate anyone using the enclosed information
(IMHO, the intellectual property of BatPower), giving credit where
credit is due (as I have attempted to do as your editor for
the past several years). Consequently, I have added the "(c)" to
the introductory screen, and consider the MUF(c) property of
BatPower. If anyone wishes to publish the enclosed information
or the ideas found herein, BatPower would appreciate a mention of
the individuals who have contributed to these "discoveries". A
mention of the MUF(c) list would be nice! ;-)

BatPower, by it's nature cannot claim ownership of these ideas,
and I'm sure they are not all originals, but, BatPower has IMHO
contributed to OUR collective knowledge of the operating system.
It certainly has expanded my knowledge... :-)

Well folks, that's it for Vol.1 #7, and my term as the MUF lists'
editor. MUF Vol. 1 #7 is MY last MUF list, as I am retiring as
the editor. Sorry folks, I have a number of other projects to
conquer. Maintaining the MUF list has taken a good deal of my
time, however, I have found the experience most informative.
I appreciate the interest that the MUF list has generated, and
the knowledge that others have shared with me here in BatPower.
I will continue to be found in BatPower, as long as our local
User's Group is able to maintain a Fido feed... We have been
having a great deal of difficulty doing so since Feb. 27/94
when Net255's satserver went fubar.

Please forward any additional information / retractions / rebuttals
/ comments / error corrections / etc. about these or other Fabulous
MUFs(c) that you may encounter to John Evans.

John has kindly volunteered to continue the tradition as the new
MUF(c) list editor. You may reach John in the FidoNet BatPower echo
or at his origin (2:2433/506). Good Luck John!

Thanks to All for the information! Till next time, (and John's first
list) we return you to our regularly scheduled BatPower program...