/build/static/layout/Breadcrumb_cap_w.png

Completely invisible batch file.

I am trying to schedule a batch file to run completely invisible to the end user via KACE. It is running ok, but no matter what I try, it pops up a command prompt window for about a second. I have an invisible.vbs file that runs it completely invisible if I run it locally, and I have added it as a dependency on the KACE Script. Any help would be greatly appreciated.

The invisible.vbs script is this:

CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False

 

My KACE script is this:

@echo off

wscript.exe "invisible.vbs" "myfile.bat"


0 Comments   [ + ] Show comments

Answers (8)

Posted by: RandomITPro 11 years ago
4th Degree Black Belt
4

There is no way to do this with a batch file alone. however if you truly require your batch file to not popup a window you can create and run the following vbs script to do exactly what you want

Set WshShell = CreateObject("WScript.Shell" )
WshShell.Run chr(34) & "yourfile.bat" & Chr(34), 0
Set WshShell = Nothing

Copy the lines above to Notepad and save the file with .VBS extension. Now you just have to copy both files and call the vbs script.


Comments:
  • Should read..

    Set WshShell = CreateObject("WScript.Shell" )

    WshShell.Run chr(34) & "C:\Batch Files\syncfiles.bat" & Chr(34), 0

    Set WshShell = Nothing - RandomITPro 11 years ago
  • I have tried this, and while it works perfectly when it is ran locally, when I push it from KACE it still pops up a command prompt. It is there for less than a second, so it's not a huge deal, but I would rather the end user not see anything at all. - WGM_Jeff 11 years ago
Posted by: andibogard 11 years ago
Blue Belt
2

I use a Bat to Exe converter that has an option to compile the exe to run invisible. There are quite a few out there, but I've been using this one http://www.f2ko.de/programs.php?lang=en&pid=b2e


Comments:
  • I am out of the office today, but I think this may work for me. I ran a few tests locally, and it looks like it may. I will test it when I get back in the office. - WGM_Jeff 11 years ago
  • iexpress is built into Windows 7.

    C:\Windows\System32\iexpress.exe - dugullett 11 years ago
Posted by: mposhaughnessy 11 years ago
Senior Yellow Belt
0

Did you ever find a solution that worked for you on this?  I would like to get rid of that split second window as well because on scheduled live scripts even a blip can be annoying when you have various ones running throughout the day

Posted by: snissen 11 years ago
Fourth Degree Green Belt
0

The utility I like for this purpose is Hidden Start at http://www.ntwind.com/software/hstart.html .

Not only does it hide the window, it can also delay and can handle UAC prompts.

Posted by: WGM_Jeff 11 years ago
4th Degree Black Belt
0

I also tried adding start /min to the beginning of the KACE script.

Posted by: pjgeutjens 11 years ago
Red Belt
0

you could look into using the NirCmd tool (http://www.nirsoft.net/utils/nircmd.html). It should allow you to run your VBS by using the execmd parameter, and should execute this without anything visible on screen.

Posted by: oreillyr 11 years ago
Fifth Degree Brown Belt
0

Try @echo off
start /B Myapp.exe
in a batch file


Comments:
  • I tried this and it still flashed the command prompt on the screen. - WGM_Jeff 11 years ago
  • sorry should read
    @echo off
    start /B Myapp.exe - oreillyr 11 years ago
Posted by: jdornan 11 years ago
Red Belt
0

A batch file is called by come.exe so there will always be that flash as it is called and then control handed back. You can't get rid of this in batch only behaviour in any reasonable way that I have seen.

You can make the flash so slight as to be almost imperceptible by renaming your batch as a .cmd file and adding @echo off as the first line. Since control isn't passed to a batch the flash is greatly reduced to be almost unnoticeable. 

 

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ