-1

I have one basic MSI installer. In this installer I have added one prerequisite which executes on .bat file. But when this prerequisites executes, the .bat file get launch by cmd prompt and it's visible to end user. I wanted to hide it's cmd prompt. How I can achieve this ? Is there any way to pass any type of arguments to .bat file or can we add any parameter in .bat file to execute it silently ?

This is the current batch file content:

@echo off
c:\Windows\sysnative\DISM.EXE /enable-feature /online /featureName:IIS-WebServerRole /featureName:IIS-WebServer
Gerhard
  • 22,678
  • 7
  • 27
  • 43
Ajit Medhekar
  • 1,018
  • 1
  • 10
  • 39
  • You search this site, the most common method you'll come across involves launching the batch file via vbscript. Of course if you were to specifically provide the batch file content, we may be able to provide a more efficient or robust method or answer. – Compo Sep 12 '19 at 10:55
  • the batch file contains only one command which installs/enables IIS on the system. @echo off c:\Windows\sysnative\DISM.EXE /enable-feature /online /featureName:IIS-WebServerRole /featureName:IIS-WebServer – Ajit Medhekar Sep 12 '19 at 11:09
  • [Please see this](https://stackoverflow.com/a/32102684/129130). And [here is a direct link](https://helpnet.flexerasoftware.com/installshield22helplib/helplibrary/SteWindowsFeat.htm). – Stein Åsmul Sep 12 '19 at 11:38
  • Well if you're only running an executable with arguments, I don't really see why you need a batch file at all. – Compo Sep 12 '19 at 13:58

2 Answers2

0

Simplest method is to create a .vbs file and add:

Set MyScript    = CreateObject("WScript.Shell")
MyScript.Run "D:\your_path_to\your_script_name_here.cmd", 0, False

Then launch the .vbs file instead of the batch file which would launch the batch file in hidden mode. Most convenient solution is to simply place both files in the same directory.

Gerhard
  • 22,678
  • 7
  • 27
  • 43
0

Microsoft has made it clear that PowerShell is the way to manage Windows. Have you used Invoke-Command or New-PSSession to run things on the user's computer over the network.

If you want to go all in for the big dog, Microsoft offers SCCM. https://www.microsoft.com/en-us/cloud-platform/system-center-configuration-manager

lit
  • 14,456
  • 10
  • 65
  • 119