Scripting help
If someone could be so kind as to show an example of how to run a silent bat file. Someone posted this code:
Launch “$(KACE_SYS_DIR)\wscript.exe” with params “//B //nologo scriptname.sh"
But I am at a loss as to how exactly to get a .bat file to excute silently with no CMD window showing up on the client. Should I create a new Online Shell Script and then post the above code in and where it says "scriptname.sh" it could point to a UNC patch where I have a simple .bat file that does the actuall install?
Answers (2)
Batch files can not be run invisibly through any parameter (ie cmd /c).
The wscript command will only work with the following file name extensions: .wsf, .vbs, .js, .sh.
Therefore, to use a batch file invisibly, a workaround must be used.
To use wscript to launch a batch file silently, follow these steps:
- Create a file named invisible.vbs (use Notepad Save As... All Files) with the following line: CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False
- Create an Online or Offline KScript
- Upload the invisible.vbs file and your batch file.
- Add the following step to Task 1: Launch “$(KACE_SYS_DIR)\wscript.exe” with params “$(KACE_DEPENDENCY_DIR)\invisible.vbs $(KACE_DEPENDENCY_DIR)\launch.bat”
*The invisible.vbs script does not need to be customized for the specific batch file, so that file you created can be used any time you need to do this.
These instructions were based on the post found here: http://forums.techguy.org/dos-other/644932-solved-howto-run-batch-file.html
I have not been able to get a batch file to install without popping up the command prompt window at all through KACE. I ended up taking the advice of someone on here, and downloaded a batch to exe converter that has an option to create an exe that will run completely invisible. Here is the link to the converter.