'*** v9.4 *** www.dieseyer.de ****************************** ' ' File: exec-hidden-plus.vbs ' Autor: dieseyer@gmx.de ' dieseyer.de ' ' Die ExecHiddenPlus-Function ruft ein weiteres Skript (das ' notfals neu geschrieben wird) auf, welches die Ausgaben ' von Befehlszeilen-Programme (mit DOS-Box) sammelt ' '*********************************************************** Option Explicit ' zum Test die nächsten drei Zeilen frei geben ' Dim Tmp ' Tmp = WScript.CreateObject("WScript.Shell").ExpandEnvironmentStrings("%Temp%") & "\" & "ExecHiddenPlus.VBS" ' WScript.CreateObject("Scripting.FileSystemObject").DeleteFile( Tmp ) MsgBox ExecHiddenPlus ( "%comspec% /c ipconfig /all" ), , "20 :: " & WScript.ScriptName MsgBox ExecHiddenPlus ( "%comspec% /c Ping 127.0.0.1 -n 1" ), , "21 :: " & WScript.ScriptName WScript.Quit '*** v9.4 *** www.dieseyer.de ****************************** Function ExecHiddenPlus( CMD ) '*********************************************************** Dim FileOut, oWsh, Tmp Tmp = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%Temp%") & "\" & "ExecHiddenPlus.VBS" If CreateObject("Scripting.FileSystemObject").FileExists( Tmp ) Then CreateObject("Scripting.FileSystemObject").DeleteFile Tmp, True End If If not CreateObject("Scripting.FileSystemObject").FileExists( Tmp ) Then ' zum Test nächste Zeile frei geben ' MsgBox Tmp & vbCRLF & vbCRLF & "F E H L T und wird deshalb neu geschrieben.", , "40 :: " & Titel Set FileOut = CreateObject("Scripting.FileSystemObject").OpenTextFile( Tmp , 2, true) FileOut.WriteLine( " WScript.CreateObject(""WScript.Shell"").Environment( ""Volatile"" )( ""Ergebnis"" ) = """" " ) FileOut.WriteLine( " set oArgs = Wscript.Arguments " ) FileOut.WriteLine( " For i = 0 to oArgs.Count - 1 " ) ' zum Test nächste Zeile frei geben ' FileOut.WriteLine( " MsgBox oArgs.item(i) , , WScript.ScriptName & "" - oArgs "" " ) FileOut.WriteLine( " if Instr( oArgs.item(i), "" "" ) > 0 Then CMD = CMD & """""""" & oArgs.item(i) & """""""" & "" "" " ) FileOut.WriteLine( " if not Instr( oArgs.item(i), "" "" ) > 0 Then CMD = CMD & oArgs.item(i) & "" "" " ) FileOut.WriteLine( " Next " ) ' zum Test nächste Zeile frei geben ' FileOut.WriteLine( " MsgBox CMD , , WScript.ScriptName & "" Anfang "" " ) FileOut.WriteLine( " Set oExec = WScript.CreateObject(""WScript.Shell"").Exec( CMD ) " ) FileOut.WriteLine( " Do Until oExec.status : WScript.Sleep 100 : Loop " ) FileOut.WriteLine( " WScript.CreateObject(""WScript.Shell"").Environment( ""Volatile"" )( ""Ergebnis"" ) = oExec.StdOut.ReadAll() " ) ' zum Test nächste Zeile frei geben ' FileOut.WriteLine( " MsgBox WScript.CreateObject(""WScript.Shell"").Environment( ""Volatile"" )( ""Ergebnis"" ), , WScript.ScriptName & "" Ende "" " ) FileOut.Close Set FileOuT = nothing End If Set oWsh = CreateObject("WScript.Shell") oWsh.Run "CScript.exe //NOLOGO " & Tmp & " " & CMD , 0, true ExecHiddenPlus = oWsh.Environment("Volatile")( "Ergebnis" ) ' zum Test nächste Zeile frei geben - Löschen der 'Tmp-Datei ' WScript.CreateObject("Scripting.FileSystemObject").DeleteFile( Tmp ) End Function ' ExecHiddenPlus( CMD )