Reputation:
I've created a simple batch file
that kicks off my *.msi installer within our company, creating a log file of the process, then displays the log file after the installer has completed.
installAndLog.bat:
msiexec.exe /i "\\FileServer2\setup.msi" /l*v "C:\setupLog.txt"
"C:\setupLog.txt"
It works, but there are two (2) glitches that annoy me:
and
I was a DOS lover back in the day, but that was too many years ago.
Upvotes: 1
Views: 216
Reputation: 1
Run the dos script as a different user by scheduled task or as a service.
Upvotes: 0
Reputation:
If you really want to get these batch windows away, you'll have to switch over to something else. One simple alternative could be one of the scripting languages supported by the windows scripting host. Or you try HTA (HTML applications) see here and here.
Upvotes: 1
Reputation: 31394
I don't think you can hide the console window when running a batch file. However you can use vbscript instead which will by default not create a console window.
Take the below and put it in a file with a .vbs extension:
Dim wshShell
Set wshShell = CreateObject("WScript.Shell")
wshShell.Run "msiexec.exe /i ""\\FileServer2\setup.msi"" /l*v ""C:\setupLog.txt""", 1, true
wshShell.Run "C:\setupLog.txt"
All the double double quotes are there because the entire command must be surrounded by "'s and doubling them escapes them. The the documentation for WshShell.Run for more info.
Upvotes: 3
Reputation: 20073
Q1 - AFAIK you can't really hide the console window.
Q2 - Use the start
command. This will launch the specified program (notepad) outside of the shell. It will also prevent the shell from waiting until the application closes to continue processing the batch script.
You might be better off changing the batch script to launch the MSI installer using the start
command and having the installer launch notepad to view the log file once installation is complete.
Upvotes: 3