Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiding a simple batch window

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
like image 629
Amir Zadeh Avatar asked Feb 02 '23 15:02

Amir Zadeh


2 Answers

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

like image 72
Bali C Avatar answered Feb 13 '23 08:02

Bali C


If your Windows system supports powershell you can place this infront of "@echo off":

cmd /c powershell -Nop -NonI -Nologo -WindowStyle Hidden "Write-Host"
like image 45
Speed Runer Avatar answered Feb 13 '23 09:02

Speed Runer