Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Modifying PIF Files in Windows

Keywords:  PIF editor	shortcut Properties sheets

Modifying a PIF in Windows 3.x

The _DEFAULT.PIF file is located in your Windows directory. This PIF contains settings that work with most MS-DOS-based applications. Windows uses the _DEFAULT.PIF file when there is no other PIF available for your application.

Because Windows might use the default PIF with more than one application, do not modify it; however, you can use the default PIF as a starting point for creating a PIF. You can follow the procedure below to modify the PIF. Then save it by using the Save As command and specifying a new filename. Your default PIF remains unchanged.

You should also check to make sure your application doesn't already have a PIF specified. You can sometimes determine this by using the Properties command on the File menu in Program Manager. The PIF is specified in the Command Line box in the Program Item Properties dialog box.

To modify a PIF:

  1. In the Main group, choose the PIF Editor icon. Depending on which mode Windows is running in, PIF Editor displays an untitled PIF that contains either standard-mode or enhanced-mode settings. (To create a PIF, you can change these options and then name the new file by using the Save As command on the File menu.)

  2. From the File menu, choose Open. In the File Name box, type the name of the PIF you want to open, or select a PIF from the list. Then choose the OK button.

  3. Change any options that are appropriate for your application. In WinBatch's case, we like to have the following two options set: Close Window on Exit, and Windowed Mode. To receive Help for a selected option, press F1 while using PIF Editor.

  4. From the File menu, choose Save. Use the same base filename as the application. For example, if the application filename (program file) is WP.EXE, use WP.PIF as the name of the PIF.

  5. From the File menu, choose Exit.

Creating a PIF in newer versions of Windows

If you are familiar with editing pifs using Windows 3.x, you'll notice the Pif Editor is gone, starting in Windows 95. Good riddance.

In its place, you can easily change the properties that are stored in a DOS program's shortcut. The shortcut stores these changes in Properties sheets. You simply right-click a DOS application's icon and change its properties.

Here's how to do it:

  1. Use the Explorer to view the folder with your *.BAT file in it.

  2. Right-click the *.BAT file, and then select Properties. A special properties window comes up that is associated with *.BAT files. Now, in the Program tab, make sure "Close on Exit" is checked, and that the Run: choice box indicates "Normal window".

    Only after you make a change to any one of the Properties sheets and then click the OK button will a shortcut be created.

  3. Now in Explorer, do a Refresh of the directory where your *.BAT file is, by going into the View menu and hitting Refresh. You should now see a file in that directory with an MS-DOS icon, which has the same root file name as your BAT file.

    If you right-click on that file with Explorer, and look at the MS-DOS file name, you'll see that it has the same root file name as your BAT file, and has the PIF file extension. You'll want to include both of these files along with your compiled WinBatch EXE.

    See How to Embed a DOS Batch File in Compiled EXE

    for further details on how to compile your DOS batch file in with your Large Standalone EXE.
If this doesn't work, at the DOS prompt, in the Windows directory, copy the DOSPRMPT.PIF to _DEFAULT.PIF. Back in win95, right click on the _DEFAULT.PIF and set all settings to the specs you want. After rebooting, any DOS session that is started will use the settings contained in the _DEFAULT.PIF, i.e., Close on Exit, Exclusive mouse usage, etc.

You can also run the PIF file (shortcuts to DOS app are PIF files) pointing to the BAT file directly, using the Run function.

Question:

Do you know of any way that I can check the contents of a PIF file?

Answer:

We don't have any WinBatch functions to do that.

The best solution is to create a new PIF file manually with whatever FILENAME.PIF you want, and have that have the settings and contents you want. Then Run the PIF file directly:

	Runwait("FILENAME.PIF", "")

Article ID:   W12875
Filename:   Creating and Modifying a PIF.txt