命令行窗口-隐藏黑窗口

要想cmd运行时隐藏黑窗口,最好的方法是使用vbs文件实现:

1、新建run.vbs,编辑内容:

set ws=WScript.CreateObject("WScript.Shell") 
ws.Run "run.bat",0

run.bat放到同目录下。运行run.vbs,没有cmd窗口弹出
只可以隐藏cmd窗口,但不能隐藏bat中打开的第三方窗口,
如yy.bat的内容为:WinRAR.exe x D:\mm.tar D:\mm22(解压tar文件)
运行run.vbs时,WinRAR的解压窗口是可以看到的。

方法2:编辑bat文件,在开头处写入

@echo off
if "%1" == "h" goto begin
mshtavbscript:createobject("wscript.shell").run("""%~nx0"" h",0)(window.close)&&exit
:begin
REM

这个方法运行bat时,cmd窗口还是闪了一下。

你可能感兴趣的:(cmdAndWindows,sql,数据库,database)