midiboy Posted April 6, 2008 Share Posted April 6, 2008 Hi !Does anyone know how to make wpi.hta ask for elevated rights in Vista upon startup? I know there has to be a manifest file next to the program file that contains something like this:<?xml version="1.0" encoding="UTF-8" standalone="yes"?><assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"><dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*" /> </dependentAssembly> </dependency> <v3:trustInfo xmlns:v3="urn:schemas-microsoft-com:asm.v3"> <v3:security> <v3:requestedPrivileges> <!-- level can be "asInvoker", "highestAvailable", or "requireAdministrator" --> <v3:requestedExecutionLevel level="highestAvailable" /> </v3:requestedPrivileges> </v3:security> </v3:trustInfo> </assembly>It should be called the same as the program so in this case it should probably be called wpi.hta.manifest but this does not work. Probably because the program is actually mshta.exe.I would like to avoid placing a manifest into the %windir% folder were mshta.exe probably resides because that would then cause all hta files to ask for elevated rights.Any other way ?Thanks,Alex Link to comment Share on other sites More sharing options...
midiboy Posted April 6, 2008 Author Share Posted April 6, 2008 Hi again !Answering my own topic because I found a workaround.I created a cmd which starts Wpi.hta this way:@echo offif exist "%windir%\system32\cmdow.exe" (cmdow @ /HID) else if exist "%windir%\cmdow.exe" (cmdow @ /HID)cd /D %~dp0set WPI="\\share"if exist %WPI% pushd %WPI%start "" /wait wpi.hta check=None timer=3000popdexitThen, I wrote a manifest file (see above post) and named it WPI_Installer.exe.manifestThen I used one of those cmd to exe programs (in my case QuickBFC) to turn the cmd into an exe and named the exe WPI_INstaller.exe. I added the manifest file to the build (the program allows to pack additional files to the exe).Now, when I doubleclick on the WPI_Installer.exe on Vista it asks for elevated rights, then it starts WPI using the above options.It would be nice though if WPI could have a commandline option to start it using elevated rights directly without the above workaround !Thanks,Alex Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now