24) %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 ===============================================================================