Skip to content
⌘ NSIS Forum Archive

Can NSIS hide a command window?

8 posts

sauroneru#

Can NSIS hide a command window?

I just found NSIS this weekend, and I love it. I have a strange problem that I was wondering if anyone could figure out. I have .exe files made from Matlab, which are 16 bit .exe's that open a command window then a GUI when executed. All I want to do is have Windows hide this command window. The name changes on different systems and on different calls, but it's always a DOS window, and I know nothing about finding HWNDs and hiding them. Here is NSIS code that at least runs one of these programs (though it still opens up a separate command window):

Name "Help"
OutFile "bar.exe"

Section "foo"
SetOutPath "c:\Program Files\Foo"
ExecWait foo.exe
SectionEnd
Pretty simple, I'm just wondering if there's a way to use NSIS's FindWindow and HideWindow commands for this extra popup. I tried this in C, and it usually works, but only when I know and enter the correct window title. I like and understand NSIS, and just thought I'd ask some experts 🙂.
sauroneru#
I had no idea there's been so much discussion on this before. I had just given up trying to find a solution 🙂. So, now I'm using
SetOutPath "c:\Program Files\foo"
nsExec::Exec "cmd /C foo.exe"
And I only have one question left. I want to make the working directory the program's installation directory (there are 2 exe's here, one for the install program, and this one). I assume this would include:

; Get the install directory created by the installer exe
ReadRegStr HKLM SOFTWARE\Foo "Install_Dir" $x

But I don't know what other steps are needed to make this the working directory for nsExec. And I love NSIS, but I've learned all I can for one weekend and need help 🙂.

Actually, this exe file will be installed in the install directory, so would it automatically start with the correct working directory?
flizebogen#
You can use variables in command parameters. As in your example the command should look like

SetOutPath "$x"

or

SetOutPath "$INSTDIR"

as a global variable. This variable is set if you used the directory page
cybereka#
Is there any similar way for ExecWait

Hai,
I was searching for this thing only but i need my installer to wait to complete the exe and so i am using ExecWait. So can i have any such way to hide the cmd windows that pops out due to this call. This will help me alot. Thanks in advance.
mumuri#edited
hello

excuse me, when i type

nsExec::Exec "cmd /C ftp.exe"

where ftp.exe is the défault ftp manager of windows(c:\windows\system32\)
it doesn't work

EDIT : i understand, nsiexe wait for the programm to end but he never end