OOMMF Using "patch" from the GnuWin32 project on Windows 7


The command "patch" is a widely used Unix text processing utility. A version of patch for Windows is available as part of the GnuWin32 project. Unfortunately, the User Account Control (UAC) on Windows 7 causes some difficulties when trying to run patch.

There are two steps to work around this problem:

  1. Modify the manifest that is embedded into patch.exe. The command-line tool "mt", which is included with Microsoft C++ Visual Studio, can be used to do this. First, create a plain text file, say patch.exe.manifest, with these contents:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
    <requestedPrivileges>
    <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
    </requestedPrivileges>
    </security>
    </trustInfo>
    </assembly>
    
    Then, run a Visual Studio command prompt as administrator — bring up
     Start -> All Programs -> Microsoft Visual C++ 200x -> Visual Studio Tools
    
    and on "Visual Studio 200x Command Prompt" right-click and select "Run as administrator". Then cd to the patch.exe installation directory, which is probably
     C:\Program Files (x86)\GnuWin32\bin
    
    and run
     mt -manifest patch.exe.manifest -outputresource:patch.exe;1
    
  2. Move patch.exe out from under C:\Program Files (x86). One option is to move the entire GnuWin32 tree to, say, C:\GnuWin32. Or, you can just copy the patch.exe file into, say, a directory under the user's home directory. If you do the latter, however, be sure that the copied patch.exe file is earlier in the user's PATH than the original patch.exe under C:\Program Files (x86).
Either one of these steps should suffice to stop the UAC dialogs for a user running on an administrator account. For a standard user (i.e., non-administrator) account, both steps are necessary.

Back to OOMMF 1.2a3 Patches, or OOMMF project at NIST


The National Institute of Standards and Technology (NIST) is an agency of the U.S. Commerce Department.

Privacy policy / security notice / accessibility statement / Disclaimer / Freedom of Information Act (FOIA) /
No Fear Act Policy / ExpectMore.gov (performance of federal programs) / NIST Information Quality Standards /
Environmental Policy Statement

Date created: May 11, 2010 | Last updated: April 27, 2011    Contact: Webmaster