I have a
.bat file I use to launch some programs. Some of them require elevated privileges (i.a. a
devcon-based does-device-exist check), but some don't. So, I run the
.bat as administrator, and use the
runas command to run the others.
runas /trustlevel:0x20000 "C:\Folder\foo.exe" runas /trustlevel:0x20000 "C:\Folder\bar.exe"
This works for some programs. However, for some it shows this error message (translated from Finnish by self, may be slightly different in English):
ERROR: Can not execute - bar.exe 740: The requested operation requires elevation.
The weird part is, if I create this
@echo off start "" "bar.exe"
and run it with
runas, it works like a charm. Their combination
runas /trustlevel:0x20000 "start \"\" \"C:\Folder\bar.exe\""
won't work, because
start is not a file. What would cause this?
Update: I tried another command, and it worked.
runas /trustlevel:0x20000 "cmd /c start \"\" \"C:\Folder\bar.exe\""
But, what I want to know is not how to make it work but why this happens.
Update 2: As suggested in comments by and31415 this is a difference between
bar.exe. But, there must be a difference between the ways of running them, as their results are different; that difference is what I'm looking for.
Update 3: I checked the manifests of the programs using Resource Editor, and here they are. Seems like they have the same execution level (
asInvoker, which is the lowest user level).
The upper one is
bar.exe and the lower one is
foo.exe. (I know, the wrong way around :D)
Update 4: Confirmed to also occur with
psexec from elevated command prompt:
psexec -l -i bar.exe
gets an error,
psexec -l -i cmd /C start "" "bar.exe"