Creating a PIF file

Archived content. No warranty is made as to technical accuracy. Content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Windows 95 Professional

A Publication of The Cobb Group

Published January 1997

One of Microsoft's main goals in creating Windows 95 was to offer a graphical interface that was easier for the novice to use. Since PIF files can be confusing to a beginner, Microsoft has downplayed their importance and done away with the PIF editor altogether.

However, as a Windows 95 professional, you may occasionally need to use a PIF file. For example, if you call a batch file from a NetWare login script, the batch file won't always close properly. But if your login script calls a PIF file that points to the batch file, the batch file will usually run correctly. In this article, we'll discuss how you can create and edit Windows 95 PIF files.

Even though Windows 95 tries to hide PIF files from desktop users, the operating system actually generates a PIF file every time you create a shortcut to a DOS program. To demonstrate, let's create a simple PIF file for a batch file that reports back the available memory for a DOS session.

Begin by using Notepad to create a batch file called MEMORY.BAT in your C:\WINDOWS directory. Your batch file should contain only one command, MEM.

For actual use, you'd probably just create a shortcut that points directly to the utility C:\WINDOWS\COMMAND\MEM.EXE. However, since Windows 95 already knows the running requirements for most of its internal programs (such as MEM and FORMAT), it doesn't create a PIF file for such utilities. If you make the shortcut call a batch file that calls MEM.EXE, Windows 95 will know only that it's calling a batch file and will treat that file as any other executable DOS program. As a result, Windows 95 will make a PIF for the program.

Now that you've created your batch file, right-click on the desktop and select Shortcut from the context menu's New submenu. When you do, Windows 95 will run the Create Shortcut Wizard. In the Command line text box, enter C:\WINDOWS\MEMORY.BAT and click the Next> button. The wizard will now prompt you to enter a name for your shortcut (this will be the name that appears under the icon). For the purposes of our demonstration, just enter Memory. Next, select an icon and click the Finish button. The icon you picked for your batch file will now appear on your desktop.

In your C:\WINDOWS\DESKTOP directory, you should see the shortcut file named MEMORY. Even though neither Windows Explorer nor My Computer will show the file's extension, it's a PIF file. Windows 95 created this file when you made your desktop shortcut to an executable program other than a component of Windows 95. If you create a shortcut somewhere other than the desktop, you'll find the PIF file in that folder.

On This Page

What about the PIF editor?

What about the PIF editor?

Now that you know how to create and find PIF files, you may be wondering how much use you can make of them. After all, the whole point of PIF files in Windows 3.1x is to let you customize a DOS program's environment. And without a PIF editor, how can you change anything? The secret is that Windows 95 shortcuts actually store the PIF settings and make them editable through the shortcuts' properties sheets.

We'll use our sample MEMORY batch file to give you a clear example of how you can still tailor your DOS programs' environments. First, double-click the MEMORY shortcut to run the batch file, which will call the MEM utility and then close, as shown in Figure A.

Cc751410.w9p9713a(en-us,TechNet.10).gif

Figure A: : Our batch file displays the amount of memory currently available to the DOS program.

Look closely at the batch file's window to note your system's current memory usage. Next, close the batch file's DOS window.

Now you're ready to begin the simple process of editing a PIF file by using a shortcut's properties sheet. Just right-click on the MEMORY icon and select Properties, and Windows 95 will display the shortcut's properties sheet. (Notice that on the property sheet's General tab, the file's MS-DOS name is listed as MEMORY.PIF.) You'll find that this feature is the Windows 95 equivalent of using the Windows 3.1x PIF editor.

Now, select the Memory tab, which lets you configure the amount of memory available to the associated DOS-based program. Next, change the available conventional memory to 200 KB by entering 200 in the Total text box in the Conventional memory panel. Finally, select None in the Extended (XMS) memory panel's Total dropdown list, and choose 1024 in the MS-DOS protected-mode (DPMI) memory panel's corresponding list, as shown in Figure B.

Cc751410.w9p9713b(en-us,TechNet.10).gif

Figure B: : The Memory tab lets you change the amount of memory that's available to the DOS application.

When you run the Memory batch file again, you'll see that the amount of your system's free memory changes, as shown in Figure C.

Cc751410.w9p9713c(en-us,TechNet.10).gif

Figure C: : As you can see, the changes you made in the shortcut's property sheet have taken effect.

The free conventional memory dropped from 577 KB to 193 KB, and the total free memory dropped from 16,961 KB to 193 KB. These changes reflect the values you entered in the batch file's properties sheet. (The values aren't exactly the same, because Windows 95 must load drivers in the memory space.)

The article entitled "Windows 95 PIF files" was originally published in Windows 95 Professional, January 1997. Copyright © 1997, The Cobb Group, 9420 Bunson Parkway, Louisville, KY 40220. All rights reserved. For subscription information, call the Cobb Group at 1-800-223-8720.

We at Microsoft Corporation hope that the information in this work is valuable to you. Your use of the information contained in this work, however, is at your sole risk. All information in this work is provided "as is," without any warranty, whether express or implied, of its accuracy, completeness, fitness for a particular purpose, title or non-infringement , and none of the third-party products or information mentioned in the work are authored, recommended, supported or guaranteed by Microsoft Corporation. Microsoft Corporation shall not be liable for any damages you may sustain by using this information, whether direct, indirect, special, incidental or consequential, even if it has been advised of the possibility of such damages.