1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Option Explicit
Function Executer(StrCmd,Console)
Dim ws,MyCmd,Resultat
Set ws = CreateObject("wscript.Shell")
'La valeur 0 pour démarrer la console MS-DOS en mode invisible
If Console = 0 Then
MyCmd = "CMD /C " & StrCmd & " "
Resultat = ws.run(MyCmd,Console,True)
End If
'La valeur 1 pour démarrer la console MS-DOS en mode visible
If Console = 1 Then
MyCmd = "CMD /K " & StrCmd & " "
Resultat = ws.run(MyCmd,Console,True)
End If
Executer = Resultat
End Function
Call Executer("FindStr /? > HelpFindStrTmp.txt & cmd /U /C Type HelpFindStrTmp.txt > HelpFindStr.txt & start HelpFindStr.txt",0)'La console en mode invisible
Dim MyCmd1,MyCmd2
MyCmd1 = "echo %ComputerName% > %ComputerName%.txt"
MyCmd2 = "FOR /f %g in ('findstr.exe /r /i ""^L ^W"" %ComputerName%.txt') DO Start Calc.exe"
Call Executer(MyCmd1,0)'La console en mode invisible
Call Executer(MyCmd2,0)'La console en mode invisible |
Partager