运行批处理命令时隐藏CMD窗口
程序员文章站
2022-06-04 08:52:46
...
IF "%1"=="" for %%c in (c:\appsoft\apply\*.dll) do regsvr32.exe /s %%c
IF "%1"=="" for %%c in (c:\appsoft\apply\*.ocx) do regsvr32.exe /s %%c
IF not "%1"=="" for %%c in (%1\appsoft\apply\*.dll) do regsvr32.exe /s %%c
IF not "%1"=="" for %%c in (%1\appsoft\apply\*.ocx) do regsvr32.exe /s %%c
IF "%1"=="" for %%c in (c:\appsoft\PUBLIC\*.dll) do regsvr32.exe /s %%c
IF "%1"=="" for %%c in (c:\appsoft\PUBLIC\*.ocx) do regsvr32.exe /s %%c
IF not "%1"=="" for %%c in (%1\appsoft\PUBLIC\*.dll) do regsvr32.exe /s %%c
IF not "%1"=="" for %%c in (%1\appsoft\PUBLIC\*.ocx) do regsvr32.exe /s %%c
exit
上述批处理命令,保存为1.bat,作为我需要运行的命令。
Set ws = CreateObject("Wscript.Shell")
ws.run "cmd /c C:\APPSOFT\1.BAT",vbhide
上述命令,保存为1.VBS
执行1.vbs时就会达到隐藏CMD窗口的效果