Hiding a simple batch window

2019-01-14 08:41发布

I've searched this and some pages came which weren't really useful or were too complicated (I am not a skilled batch file programmer!)! What I need is to run a batch file in hidden form (no console window). The batch file will not be called from external application or code. It will be clicked on by the client and then I want no console pages to be shown (only pages which are called by call command should be shown)! The batch file is exactly as follows:

@echo off
call setup.exe
IF EXIST "C:/caillog" goto tracking 
IF NOT EXIST "C:/caillog" goto end


:tracking
call dotnet4.exe
call ClientService.msi
goto end

:end

2条回答
贼婆χ
2楼-- · 2019-01-14 09:28

As others have said, use VBS.

Set WinScriptHost = CreateObject("WScript.Shell")
WinScriptHost.Run Chr(34) & "C:\FilePath" & Chr(34), 0
Set WinScriptHost = Nothing

This is what I use.

查看更多
时光不老,我们不散
3楼-- · 2019-01-14 09:31

I use VBScripts to open it hidden, like this:

Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run("%batchfile%"), 0, True

for e.g the bat file I want to run is run.bat then I'll do like this

objShell.Run("run.bat"), 0, True

Instead of running the batch file run the vb file.

Write it in notepad and save it as *.vbs

查看更多
登录 后发表回答