巫毒用DOS批处理文件 [英] Voodoo with DOS Batch files

查看:199
本文介绍了巫毒用DOS批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个简单的批处理文件揭开序幕我的 *。MSI 我们公司内部的安装程序,创建过程的日志文件,然后显示日志文件安装程序完成后。

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"

它的工作原理,但有两个(2)故障是激怒了我:

It works, but there are two (2) glitches that annoy me:


  • 黑控制台框显示在背景中的全部时间运行安装程序时,正在显示的日志文件。 Q1:我如何隐藏

  • The black console box shows in the background the whole time the installer is running and the log file is being displayed. Q1: How do I hide that?


  • 控制台框不会关闭,直到日志文件将不再被视为(即NOTEPAD.EXE被关闭)。 Q2:我可以调用一个新的进程的文本文件,并表示退出

  • The console box will not close until the log file is no longer being viewed (i.e. notepad.exe is closed). Q2: Can I call the text file in a new process and simply exit?

我是DOS的情人回到了一天,但这是太多年前。

I was a DOS lover back in the day, but that was too many years ago.

推荐答案

我不认为运行批处理文件时可以隐藏控制台窗口。但是,您可以使用VBScript来代替,这将在默认情况下不会创建一个控制台窗口。

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.

以低于并把它放在一个文件与.vbs扩展名:

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"

所有双重双引号那里,因为整个命令必须由包围http://msdn.microsoft.com/en-us/的倍增和他们逃脱他们。在对的的 WshShell.Run 了解更多信息。

这篇关于巫毒用DOS批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆