![]() |
#1 |
Junior Member
Join Date: Apr 2020
Posts: 22
|
nsExec with Admin rights
I use nsExec::ExecToStack /OEM
to execute a command line instruction. But the program refuses to run because it does not have administrator privileges. What can I do? |
![]() |
![]() |
![]() |
#2 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,548
|
Ideally you should use "RequestExecutionLevel Admin" to make the installer elevate if you intend to run any child processes elevated.
nsExec can't elevate because its reason to exist is to handle stdout and to elevate it would have to call ShellExecuteEx and then you lose control over stdout. It could theoretically be done by using a extra helper process but the plug-in does not currently support that. Your best bet is to use ExecShellWait with the "runas" verb. You lose control over stdout and elevation will NOT work if UAC has been turned off and it might not elevate on < Vista. IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#3 |
Junior Member
Join Date: Apr 2020
Posts: 22
|
thank you
RequestExecutionLevel Admin works! |
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|