Skip to content
⌘ NSIS Forum Archive

Help needed on showing OptionalFeatures.exe dialog from NSIS

6 posts

arunvv06#edited

Help needed on showing OptionalFeatures.exe dialog from NSIS

Hi,

I would like to clear a doubt on nsis..

I want to show the windows feature (Windows Feature Turn On Off) popup using the nsis script. How could i do that?

Currently i am using the below script to show the windows feature..

ExecWait '"$WINDIR\\System32\\OptionalFeatures.exe"'

But this script is not loading the Windows feature popup. I think some permission is restricting it from showing from the system32 folder. But we could successfully loads some other .exe files from that folder. Only this .exe have the problem occurring.

I urgently need your help.

Regards
Arun vv
arunvv06#
Thanks for your reply Anders..
My machine is UAC elevated.. I have tried using the ExecShell command you have mentioned above. It didn't work. The issue is happening in Windows 8, 8.1, and 10 machines.
Our customer needs to show the windows features dialog before aborting the installation if .net framework is not installed. That is why i need this to resolve.
It seems to be working in windows7. But in windows 8 and above it is not working.
Please help...
Anders#
%windir%\system32\OptionalFeatures.exe is documented as the correct command on MSDN but for some stupid reason this .exe only exists in the 64-bit system32 directory on 64-bit systems.

Disable the FS redirection so you can access the .exe:
!include x64.nsh
${DisableX64FSRedirection}
ExecShell "" "$WinDir\System32\OptionalFeatures.exe"
${EnableX64FSRedirection}
A less hacky solution (you are not supposed to disable redirection when using shell stuff) would be to create a custom little 64-bit application that you can execute!
arunvv06#
Eurekaa.. thank you very much Anders.. It is now working as expected..
One doubt.. then how is it showing the dialog when we double click on the exe directly from the system32 folder?
Anders#
That only works in 64-bit applications. Try it in a 32-bit app and the system32 folder does not even have that .exe file. Google SysWow64 for more information or check https://msdn.microsoft.com/en-us/lib...87(VS.85).aspx