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

Comments

Please log in to comment

Community Chosen Answer

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.

Answered 04/16/2012 by: Tentacle Master
Fourth Degree Black Belt

  • Should read..

    Set WshShell = CreateObject("WScript.Shell" )

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

    Set WshShell = Nothing
  • 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.
Please log in to comment

Answers

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

Answered 04/17/2012 by: andibogard
Blue Belt

  • 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.
  • iexpress is built into Windows 7.

    C:\Windows\System32\iexpress.exe
Please log in to comment
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

Answered 09/10/2012 by: mposhaughnessy
Senior Yellow Belt

Please log in to comment
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.

Answered 04/20/2012 by: snissen
Fourth Degree Green Belt

Please log in to comment
0

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

Answered 04/16/2012 by: WGM_Jeff
Fourth Degree Black Belt

Please log in to comment
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.

Answered 04/16/2012 by: pjgeutjens
Red Belt

Please log in to comment
0

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

Answered 04/16/2012 by: oreillyr
Fifth Degree Brown Belt

  • I tried this and it still flashed the command prompt on the screen.
  • sorry should read
    @echo off
    start /B Myapp.exe
Please log in to comment
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. 

 

Answered 11/26/2012 by: jdornan
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share