Tim said:
I have several batch files that run throughout the day at
specific intervals. They keep on popping up the command
screen and disapper after execution. This annoys as we
cannot concentrate on the monitor screen doing some other
tasks. Is there a command that I can insert in the
beginning of each batch files so that the command screen
is minimised while it is in execution?
Hi
You can e.g. use a vbscript based batch file launcher for this.
Run it like this:
wscript.exe "C:\My Scripts\BatchLaunher.vbs" "C:\My Scripts\tst.bat"
In the code below, it is the 0 in this line that hides the
batch file execution:
oShell.Run """" & sFilePath & """", 0, False
If you want to run it visible, but minimized, change the 0 to 7.
Content of BatchLaunher.vbs:
'--------------------8<----------------------
sTitle = "Batch launcher"
Set oArgs = WScript.Arguments
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")
If oArgs.Count <> 1 Then
MsgBox "Error: You need to supply a file path " _
& "as input parameter!", vbCritical + vbSystemModal, sTitle
Wscript.Quit
End If
sFilePath = oArgs(0)
If Not oFSO.FileExists(sFilePath) Then
MsgBox "Error: Batch file not found", vbCritical + vbSystemModal, sTitle
Wscript.Quit
End If
' add quotes around the path in case of spaces
oShell.Run """" & sFilePath & """", 0, False
'--------------------8<----------------------
WSH 5.6 documentation (local help file) can be downloaded
from here if you haven't got it already:
http://msdn.microsoft.com/downloads/list/webdev.asp