MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: Batch Files[Next]: Batch File Parameters
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Tips and Tricks->Batch Files->Batch File Tips and Tricks

Batch File Tips and Tricks

If you are after information on how to execute batch files during installation then have a look at the "ExeCa" command as this section describes some useful things to know.

You need to be very careful to confirm that the features you use exist in the operating systems you are supporting, a lot (but probably not all) of the following is likely to work in WINNT+ (WINNT, WIN2000, WINXP etc).

The most useful standard Windows commands are probably (use the "/?" switch on command to see its documentation):

  1. FOR
  2. SET
  3. FIND / FINDSTR.EXE
  4. SETLOCAL (setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION)
  5. START

Some tips on specific commands:

There are many interesting web sites where you can get more information (a good google should find them), there are quite a few good tips (and subroutines) at the "Batch Function Library for Windows NT4/2000/XP/2003" site.

The following sections have specific tips:

  1. Batch File Parameters
  2. Convert Long FileNames to Short (8.3)
  3. Create File containing IP addresses from file with Workstation List
  4. Delayed Expansion (in loops)
  5. Get Day, Month, and Year
  6. Get File Safe Dates and Times
  7. Does a File Contain Some Text?
  8. For Loops
  9. Get Name/Directory of the Batch File
  10. Indirect Access to Environment Variables (by reference)
  11. Logging RollOver (keep "x" logs)
  12. Logging Whole Batch File Execution
  13. Maths
  14. Meaningful Return Code
  15. Read and Process a File line by line
  16. Read first line of a Text File
  17. SET Command
  18. String Replacement
  19. SubString Extraction
  20. Special Characters (tabs etc)
  21. Subroutines (common code)
  22. Sweep (Execute command(s) per File or Directory)
  23. VBSCRIPT Subroutines in BATCH files

Batch Files - External Links

Some good external links:


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: Batch Files[Next]: Batch File Parameters


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Friday October 13 2017 at 2:08pm
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.