1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| Option Explicit
Function Executer(StrCmd,Console)
Dim ws,MyCmd,Resultat
Set ws = CreateObject("wscript.Shell")
'The value 0 to hide the console of MS-DOS
If Console = 0 Then
MyCmd = "CMD /C " & StrCmd & " "
Resultat = ws.run(MyCmd,Console,True)
End If
'The value 1 to show the console MS-DOS
If Console = 1 Then
MyCmd = "CMD /K " & StrCmd & " "
Resultat = ws.run(MyCmd,Console,True)
End If
Executer = Resultat
End Function
'***********************************************************Some Examples*******************************************************************
'Call Executer("mode con cols=80 lines=30 & Color 0A & Title Help for Rar in command line & cd %programfiles%\winrar & cmd /k Rar /?",1)'showing the console
'Call Executer("mode con cols=80 lines=30 & Color 0A & Title Help for FCIV in command line & cd %programfiles%\FCIV & cmd /k FCIV.exe /?",1)'showing the console
'Call Executer("mode con cols=90 lines=15 & Color 0A & Title Ping sur www.visualbasicscript.com by Hackoo & Ping www.visualbasicscript.com",1)'showing the console
'Call Executer("FindStr /? > HelpFindStrTmp.txt & cmd /U /C Type HelpFindStrTmp.txt > HelpFindStr.txt & start HelpFindStr.txt",0) 'console in hidden mode
'Call Executer("mode con cols=80 lines=50 & Color 9B & Title Hackoo & netstat -a",1) 'showing the console
'Call Executer("mode con cols=80 lines=30 & Color 9B & Title Tracert to www.visualbasicscript.com by Hackoo & Tracert www.visualbasicscript.com",1)'showing the console
'***********************************************************Some Examples*******************************************************************
'Call Executer("cd %programfiles%\Microsoft Dynamics CRM\Client\ConfigWizard & cmd /k Microsoft.CRM.Application.Outlook.ConfigWizard.exe /Q /i %TEMP%\config_client.xml /xa",1)
'Call Executer("cd %programfiles%\DVD Maker & DVDMaker.exe",1)
'Call Executer("cd %programfiles%\comodo\comodo internet security & virtkiosk.exe",0)
Dim MaCmd
MaCmd = "@echo off & for /f ""skip=1 tokens=1"" %a in ('wmic path win32_localtime get dayofweek ^| findstr /b /r "".""') do set /a dds=%a +1 & for /f ""tokens=%dds%"" %a in (""Dimanche Lundi Mardi Mercredi Jeudi Vendredi Samedi"") do set jour=%a & echo Aujourd'hui c'est le : %jour% & pause"
msgbox MaCmd
Call Executer(MaCmd,1) |
Partager