Create exe with "Run as Administrator"

Mar 9, 2013 at 11:03 AM
Edited Mar 9, 2013 at 11:04 AM
Hi . I remember in C# we put this command and that will force the .exe file to be run as administrator , I wonder that could happen in PS2EXE .

<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
May 10, 2013 at 1:17 AM
Edited May 10, 2013 at 2:14 AM
This would be a fantastic addition.
With the .net 3.5 compiler, you can pass a manifest file which would include the line you specified (/win32manifest:<file>). I haven't figured out a way to do it with 2.0 however, my C# knowledge is very limited.


EDIT::
Using MT.exe (part of .NET Framework 2.0 Software Development Kit (SDK) ) you can edit the existing manifest.

Rename your ps2exe compiled EXE to "ExeName.exe". Then copy the below code into a text editor and save it as ExeName.exe.manifest within the same folder.
<?xml version="1.0" encoding="utf-8" ?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity version="1.0.0.0" 
      processorArchitecture="X86"
      name="PS2EXEProject"
      type="win32" />
  <description>MyProjectDescription</description>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="requireAdministrator" />
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>
Then run:
mt.exe -manifest ExeName.exe.manifest -outputresource:ExeName.exe;#1