How to use VPatch

How to use VPatch to develop/apply patches to EXEs

VPatch is a Van de Sande Productions freeware/donationware application that consists of multiple command-line tools with an optional GUI front-end. In addition to obtaining it from the above website, it can be found mirrored here.

My interest in this tool is that it can successfully patch .NET assemblies.

To generate a patch file (the file that will contain the binary difference between oldversion and newversion of your app, run at the commandline:

GENPAT (sourcefile) (targetfile) (patchfile)

If you haven't added the VPatch directory to your PATH variable, then you'll have to type out the full path to GENPAT.

(sourcefile) is your oldversion.exe and (targetfile) is your newversion.exe. (patchfile) is the name you want to give the patch you create, e.g. patch.pat.

To create a patcher (i.e., a program you can run in same directory in which oldversion.exe and patch.pat are located in order to apply a patch), you can either:


VAPPEND data.pat vpatch.exe vpatch.bin


(b) use the GUI's "Create patch file" button.

To apply a patch to oldversion.exe, you can use either of the following:


VAPPEND (patchfile) [output file] [runtime] 

where an example looks like this:

VAPPEND (patchfile) [output file] [runtime] 

VAPPEND data.pat vpatch.exe vpatch.bin

or, to apply a patch:


VPATCHPROMPT.EXE (patchfile) (sourcefile) (outputfile)

You can create a Windows batch file to run the patch-applier. For example, the following apply_patch.bat contents would patch oldversion.exe to newversion.exe:

vpatchprompt.exe patch.pat oldversion.exe newversion.exe

After creating such a batch file, you could distribute the following three files to end-users, with instructions to extract them into the same directory as oldversion.exe before running apply_patch.bat: