First the nasty business...

AUTHOR'S DISCLAIMER
The author makes absolutely NO claims of responsibilty of any kind, including
but not limited to, accuracy, completeness or undesirable effects resulting 
from the procedure described below.  Perform the following at your own risk.  
It is very possible that that you or even another program has modified your 
Windows setup so that the information below is either innacurate or incomplete.
The importance of making backup files cannot be stressed enough.  That's why
it is part of the step by step procedure described below.  This disclaimer
includes the program which accompanies this text file.

Enough said...on to the good part...

Here's a little trick I use to allow quick and easy editing of batch files 
under Windows.  Please print this file so you have reference to it while you 
are performing this procedure.  The steps labeled with numbers are the main 
steps to perform.  The "sub-steps" labeled with lowercase letters are DOS 
commands to accomplish the associated main step.  Whenever the instructions 
say to type something, what you should type is enclosed in quotes.  Do NOT 
type the quotes themselves.  There are 2 different procedures you can choose
from.  Use whichever one you prefer; they both accomplish the same thing.


PROCEDURE 1
1.  If you're running Windows, exit to DOS (not a DOS prompt under Windows).

2.  Switch to your Windows directory and make a backup of your WIN.INI file.  
    If anything goes wrong, you can easily restore your WIN.INI file.
    
    a. CD\WINDOWS
    b. COPY WIN.INI WIN.BAK

3.  Open WIN.INI in any ASCII text editor.  MS-DOS Editor works very well for 
    this, as most people should have this program.
    
    a. EDIT WIN.INI

4.  Several lines from the top of the file, there should be a line that looks 
    like "Programs=com exe bat pif".  Change this to read 
    "Programs=com exe pif".  Save the file and exit MS-DOS Editor.  What this 
    line does is to tell Windows which file extensions are executable 
    programs; in other words, programs that can be run by specifying the file
    name.  By removing the "bat", we are telling Windows that files with a 
    .bat extension cannot be executed.

5.  Find the file REG.DAT in your Windows directory and make a backup of it.

    a.  CD\WINDOWS
    b.  COPY REG.DAT REG.BAK

6.  Start Windows and then start File Manager.  Highlight, but do not double 
    click on, any file with a .bat extension.  Pull down the File Menu and 
    select Associate... from it.  Scroll through the list of entries until you 
    find one for Text File.  Select this and click the OK button.  This step 
    makes one major assumption, and that is that the Text File entry has not
    been previously altered.  Windows associates Text Files with Notepad 
    automatically during the initial Windows Setup.  Some installation programs
    may have altered this to use their own text editor.  There is a very simple 
    test to determine this:  In File Manager, double click on any file under 
    50K that has an extension of .txt.  If Notepad starts with that file 
    opened, you're all set.  If a program other than Notepad starts with that
    file opened, the only difference should be that the batch file will be 
    opened in that editor and not Notepad.  If you get a message stating that
    no association exists, consult pages 130 - 132  of your Windows User's 
    Guide.

6.  You're all done!  Simple, huh?

PROCEDURE 2

1.  If you have the Visual Basic runtime module version 3 (vbrun300.dll), run
    the program which accompanies this text file.

2.  You're all done!  Really simple, huh?

This program will automatically create the backup files and verify that .txt
files are associated with an application.  It will then configure .bat files
to use that same association.  If .txt files are not associated with any 
application, you will be given the option of creating the default Windows
configuration of associating .txt and .ini files with Notepad, as well as
associating .bat files with Notepad.  After successfully updating Windows,
you will be asked whether or not to re-start Windows.


You'll now be able to double click on almost any file with a .bat extension 
and that file will be opened up inside of Notepad, ready for editing.  I say 
almost any file because files in Notepad are limited to approximately 50K.  I 
have personally never seen or even heard of a batch file this large, but that 
doesn't mean some guru didn't write one.

You can also specify the batch file using the File|Run command of 
Program Manager or File Manager.  For example, in the Command Line box, just 
type any file name that has a .bat extension.  You do not need to specify 
Notepad in the command line, but you MUST include the .bat extension.  Windows 
will know that this file should be opened up inside of Notepad.

You're probably now saying "Well, that's all fine and dandy, but how do I RUN 
my batch programs?"  Remember that "Programs=" line in WIN.INI?  There was an 
extension on that line called pif.  For those that are not familiar with these 
types of files, PIF stands for Program Information File.  These files are 
basically data files that tell Windows how to run DOS programs, but they can 
be executed like conventional program files.  You create and edit PIFs using 
the PIF Editor, which should be located in the Main program group of Program 
Manager.  Open PIF Editor and in the Program Filename box, type the file name 
of any batch program.  Set all the other options as necessary.  Most batch 
files are relatively small, therefore, it is not usually necessary to provide 
a lot of memory for them.  For the Memory Requirements settings, try specifying 
256K for KB Required and 384K or less for KB Desired, but do NOT set KB Desired 
lower than what you have for KB Required.  For EMS and XMS Memory settings, 
you can probably specify 0 for all 4 settings.  For information on all the 
other settings and options for PIFs, see your Windows User Guide or simply 
bring up the PIF Editor Help.

Now that you've got the PIF configured properly, pull down the File Menu and 
select the Save As... command.  Use the Directories and/or Drive boxes to 
change to the same directory that your batch file is located in and type in 
the same file name as the batch file, but substitute the extension "pif" for 
"bat".  For example, if your batch file is called "myprog.bat", type 
"myprog.pif" in the File Name box.  Click the OK button to save the PIF.  
Now to run the batch file, simply double click on the PIF file instead of the 
BAT file in File Manager, or from the File|Run command type "myprog.pif" 
instead of "myprog.bat".

The program which is included in this archive, obviously, cannot create the 
PIFs for you.  You must do that yourself.

There are many variations to this setup that you can make.  For example, you 
can specify the full path to the batch file in the Program Filename box of the 
PIF Editor and keep all your PIFs together in one directory and still be able 
to execute all your batch files.  Personally, I prefer to keep PIFs used for 
starting batch files in the same directory as the batch file and sort the files 
in File Manager by their name.  That way, the PIF and the BAT files are right 
next to each other.  PIFs that are used to start DOS programs, such as MS-DOS 
Editor, I keep in a subdirectory called PIFS off of the Windows directory.  
I then create an icon in Program Manager and specify the appropriate directory 
in the Working Directory box of the Program Item Properties dialog.

I hope that you find this tip useful.  If you find that you don't like it,
well, that's what the backups are for.  Simply rename them back to their 
original filename and all will be as it was.

For any VB programmers out there, I have also included the VB source code for
the program, if you want to take a closer look at exactly what the program
does.  The source code is fully commented.  Feel free to use anything in it
for use in your own programs.

If you have any questions or there is something that I didn't make clear,
I can be reached through E-Mail at VDG Mike on America Online and at 
73122,1474 on CompuServe.

Happy Computing!

Mike Davis

