Hiding the cmd window - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

sony
Posts: 134
Joined: Wed Apr 07, 2010 9:55 am

Hiding the cmd window

Hi Support,

I am trying to run a .bat file along with the parameters. Trying to hide the command prompt window from AI. I have tried to use the aicustact.dll available in "C:\Program Files\Caphyon\Advanced Installer 7.7\custact\x86" folder and set the function name as "CreateEXEProcess". In the action data, I have given the bat file name along with the parameter.If the bat executes succcessfully, it creates an window service in the service.msc list.

But the bat is not getting executed..

Please let me know your suggestions at the earliest.

Regards
Sony
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Hiding the cmd window

Hi Sony,

Please follow this thread to find out how you can hide the cmd window.
Another way is described in our how to article from the guide.

Best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sony
Posts: 134
Joined: Wed Apr 07, 2010 9:55 am

Re: Hiding the cmd window

Hi Mihai,

I have followed the steps given in the following thread. But it wasnt working.

"Please follow this thread to find out how you can hide the cmd window."

I have copied the code in a .vbs file and tried to execute the file, but the .bat is not executing. In order to execute the bat file, need to pass the commandline parameters to the bat file.

Here is the code.
const WindowStyleStealth = &H20000000
set WSO = createobject("WScript.Shell")
WSO.run "%comspec% /c installservice.bat "[DIR]"", WindowStyleStealth, false

where "[DIR]" is the parameter that has to be passed to the bat file. But this is not working. Please let me know, if I am doing anything wrong.

Regards
Sony
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Hiding the cmd window

Hi Sony,

Please try this syntax:

Code: Select all

const WindowStyleStealth = &H20000000
set WSO = createobject("WScript.Shell")
WSO.run "%comspec% /c installservice.bat [DIR]", WindowStyleStealth, false
I have tested it and it works fine. Try and reproduce the issue on an separate project, as well as running the VBS and BAT file outside Advanced Installer.
If it persists please give us the details and send the .AIP (project) and a verbose log of the installation to support at advancedinstaller dot com so we can investigate them.

Also, if this doesn't work you can use the approach mentioned in our user guide(the second solution from my last post).

Regards,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sony
Posts: 134
Joined: Wed Apr 07, 2010 9:55 am

Re: Hiding the cmd window

Hi Mihai,

I need to pass the parameter [DIR] along with the quotes to run the bat file i.e "[DIR] . unable to pass this parameter using the vbscript.

Please let me know, how can I pass the argument to the bat file along with the quotes in the vbs file?

Regards
Sony
sony
Posts: 134
Joined: Wed Apr 07, 2010 9:55 am

Re: Hiding the cmd window

Mihai,

Any Suggestions?

Regards
Sony
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Hiding the cmd window

Hello Sony,

I apologize for the late reply.

If by your "[DIR]" parameter you mean a public property from Advanced Installer, then here is how you get the property in your VBScript:

Code: Select all

value = Session.Property("DIR")
where DIR is the public property.

Let us know how this worked for you.

Regards,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sony
Posts: 134
Joined: Wed Apr 07, 2010 9:55 am

Re: Hiding the cmd window

Hi Mihai,

Can you please explain your suggestions in detail..

Regards
Sony
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Hiding the cmd window

Hello Sony,

If your parameter is a public property the script should look something like:

Code: Select all

Dim Parameter
Parameter = Session.Property("DIR")
const WindowStyleStealth = &H20000000
set WSO = createobject("WScript.Shell")
WSO.run "%comspec% /c test.bat "&Parameter&"", WindowStyleStealth, false
If this is not the case, can you please give us more details about the "[DIR]" parameter you are passing to your BAT so we can formulate an appropriate solution scenario?

Regards,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sony
Posts: 134
Joined: Wed Apr 07, 2010 9:55 am

Re: Hiding the cmd window

Hi Mihai,

Initially, I have tried to execute your code outside the installer. Here is the code:

Dim Parameter
Parameter= "C:\NGN Package\"
const WindowStyleStealth = &H20000000
set WSO = createobject("WScript.Shell")
WSO.run "%comspec% /c install-service.bat "&Parameter&"", WindowStyleStealth, false

By doing this, only "C:\NGN" value is getting passed instead of "C:\NGN Package\" value. I have attached the path error screenshotsin "Newfolder.zip" folder along with the bat file.

From the installer, the service is not getting installed at all..

"[DIR]" parameter is a installation folder path which is passed to the bat file to install the service as windows service.

I hope this might help you.

Regards
Sony
Attachments
New Folder.zip
(83.81 KiB) Downloaded 999 times
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Hiding the cmd window

Hello Sony,
By doing this, only "C:\NGN" value is getting passed instead of "C:\NGN Package\" value.
Yes this is correct, if the value is a string(specifically a path in your case) and it contains white spaces, the syntax from my last post will truncate the string and pass every character until the first white space.
"[DIR]" parameter is a installation folder path which is passed to the bat file to install the service as windows service.
To pass a string which contains white spaces as a parameter, you can try this syntax:

Code: Select all

Dim Parameter
Parameter= "C:\NGN Package\"
const WindowStyleStealth = &H20000000
set WSO = createobject("WScript.Shell")
WSO.run "%comspec% /c install-service.bat """& Parameter &"""", WindowStyleStealth, false
Regards,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sony
Posts: 134
Joined: Wed Apr 07, 2010 9:55 am

Re: Hiding the cmd window

Hi Mihai,

I have used the following code:

Dim Parameter,WSO
Parameter=Session.Property("DIR")
const WindowStyleStealth = &H20000000
set WSO = createobject("Scripting.FileSystemObject")
WSO.run "%comspec% /c install-service.bat """& Parameter &"""", WindowStyleStealth, false

I am getting an error while executing the vbscript. Please find the error screen shot in the attachment.

Regards
Sony
Attachments
error.zip
(209.6 KiB) Downloaded 998 times
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Hiding the cmd window

Hello Sony,

To have access to a public property from your script you need to set the custom action that launches the script with an "Immediate execution" from the Custom Actions page.
If this is not the case, please send us the .AIP (project) and a verbose log of the installation to support at advancedinstaller dot com so we can investigate them.

Regards,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sony
Posts: 134
Joined: Wed Apr 07, 2010 9:55 am

Re: Hiding the cmd window

Hi Mihai,

I have set the custom action as "Immediate action", but .bat file is not getting executed. I have attached the verbose log in the attachment.

Its an urgent requirement. Please provide your suggestions at the earliest.

Regards
Sony
Attachments
NGN1.0.0.log
(393.89 KiB) Downloaded 1052 times
sony
Posts: 134
Joined: Wed Apr 07, 2010 9:55 am

Re: Hiding the cmd window

Any suggestions?

Regards
Sony

Return to “Common Problems”