Issue:
The Dell Kace agent opens a blank command processor window. Users can close the window causing the script to end prematurely.
Script type: Online shell script.
Script text: cscript hidecmd.vbs
Dependencies: HideCMD.VBS, Test.bat
--- Test.bat ---
echo do something here
--- end test.bat
---- HideCMD.VBS ---
dim NameOfBatch, CurrentDirectory, FullPath
NameOfBatch = "test.bat"
'Get current directory where the batch file is running
CurrentDirectory = left(WScript.ScriptFullName,(Len(WScript.ScriptFullName))-(len(WScript.ScriptName)))
' for debugging only WScript.Echo currentDirectory
FullPath = CurrentDirectory&NameOfBatch
'From MS website on how to hide a command processor window
Const HIDDEN_WINDOW = 12
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = HIDDEN_WINDOW
Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")
errReturn = objProcess.Create(FullPath, CurrentDirectory, objConfig, intProcessID)
---- end HideCMD.VBS ---
Next, how can I get the next task item to launch? The cscript launching the vbs works but in my script it needs to wait for the bat to comple before the next itme can do its thing; extract my concatinated zip file. The result is run failure, obviously because it had nothing to extract or it appeared corrupt. - worzie 11 years ago
start /wait copy /b partfile.* file.zip
That'll force that long copy process to wait until it's done before moving on. - briancollins 11 years ago