Page 2 of 2

Re: Windows/UAC - Launch another program not as administrator?

Posted: Sat Oct 19, 2024 4:12 am
by BarryG
@JHPJHP: The code you sent works: I get 2 x CMD.exe windows opened, the first elevated and the second, not. Thanks! :)

Re: Windows/UAC - Launch another program not as administrator?

Posted: Sun Oct 20, 2024 8:44 am
by fryquez
There is also a way to call shellexecute from shell explorer.

viewtopic.php?p=563728#p563728

Re: Windows/UAC - Launch another program not as administrator?

Posted: Sun Oct 20, 2024 1:15 pm
by ChrisR
Tested ShellExecInExplorerProcess with:

Code: Select all

ShellExecInExplorerProcess("cmd.exe", "/C Whoami & Net Session 1>NUL 2>NUL && (Echo Run with elevated rights) || (Echo Run without elevated rights) & Pause")
It does the job, great :)

Re: Windows/UAC - Launch another program not as administrator?

Posted: Sun Oct 20, 2024 2:03 pm
by JHPJHP
Hi BarryG,

Looks like you were already part of the thread back in 2020.

I not only agree with the previous posts, but tested it Six ways to Sunday and it seems to be a better solution for your requirements.

Definitely worth a second look :!: great job fryquez.

Re: Windows/UAC - Launch another program not as administrator?

Posted: Sun Oct 20, 2024 10:04 pm
by BarryG
JHPJHP wrote: Sun Oct 20, 2024 2:03 pmLooks like you were already part of the thread back in 2020
Yeah, I totally forgot about that. I think something must be up with it that I discovered since, which is why I got initially excited with it but then had to abort it and ask again the other day. I'll do some tests to see why I gave up on it.