Make your own free website on
 Tips & Trix
Spiffy DosCommands

Grafx Pax
Tips & Trix
Search NeoDezign


If for some reason you need to use an external DOS batch file in your program you can do so without the embarrassment of the DOS box appearing when the BAT program is executed. Sometimes inquisitive people, like us, will venture into your program folder to look at the files that were installed by Setup. I don't know about you, but I don't want my BAT program and my PIF file sitting there for all the world to see! 

Hide your BAT files by first writing them with your program using the FileWrite command, then, delete the BAT program using FileErase. 

FileWrite "[PubDir]listexec.bat" "1" "dir [WindowsDir]\*.exe /b > [PubDir]winexecs.lst"

Most everyone is familiar with the PIF file. It contains settings that specify whether a DOS process starts in a full screen, in a window, or minimized. Usually, our need for a DOS Batch process from a NeoBook app is brief. One or two commands and we're 'outta there'. So, if you use a PIF file to run the Batch file minimized the process goes almost un-noticed. Well, at least it's better than a DOS box!

Use a PIF file to run your BAT program Minimized with Close on Exit. Choose an Icon. Everyone with Win95 has the PIFMGR.DLL file on their system so you can assign an appropriate icon to your PIF file and rest assured that your external process will look the same everywhere it is run.

Create your PIF file by making a shortcut to your BAT program. Place this shortcut in the same folder as your Publication. Then, use the settings listed below...

1) Right-click on the shortcut and select Properties. 
2) Click the Program tab. 
3) Remove any Path statements from the Cmd line 
4) Under the Run menu select Minimized 
5) Check Close on Exit 
6) Press the Change Icon button and select an icon

We've already established how to hide BAT programs by writing then erasing them.  However, we won't be able to create PIF files on-the-fly like BAT files. Instead, go out to a DOS prompt and Rename the extension of your PIF file to something totally obscure. 

> Ren   listexec.pif   listexec.zx9

By using an extension that is not registered with Windows it cannot be executed with a double-click from Explorer and the icon will change to the Windows Default icon. Now your PIF file is hidden.


Finally, we can get on to actually using all this...  Here is an example of what the Action script might look like:

./// create bat program
FileWrite "[PubDir]listexec.bat" "1" "dir [WindowsDir]\*.exe /b > [PubDir]winexecs.lst"
./// copy to pif
FileCopy "[PubDir]listexec.zx9" "[PubDir]listexec.pif"
./// execute pif
DOSCommand "[PubDir]listexec.pif" "" "Wait"
./// erase files
FileErase "[PubDir]listexec.bat"
FileErase "[PubDir]listexec.pif"

Another plus is that you can now package the renamed PIF file with your program using a third party Setup program. While it had the extension ".PIF" the Setup program might try to compile the target BAT file instead of the PIF file.