Vbscript commandes dos

Résolu
cs_ghofrane Messages postés 44 Date d'inscription mardi 18 juillet 2006 Statut Membre Dernière intervention 11 août 2009 - 14 mars 2007 à 21:58
CCJ Messages postés 565 Date d'inscription mercredi 19 mai 2004 Statut Membre Dernière intervention 30 avril 2008 - 15 mars 2007 à 18:49
bonsoir,
est ce que je peux exécuter par exemple la commande
net start ou ping ou ipconfig ... a travers un fichier vbscript.
c'est à dire en appyant sur un bouton je lance un fichier
vbscript qui lui va lancer la commande dos voulu.
merci

5 réponses

CCJ Messages postés 565 Date d'inscription mercredi 19 mai 2004 Statut Membre Dernière intervention 30 avril 2008 1
15 mars 2007 à 18:05
Set objScriptExec = objShell.Exec( "ping -n 2 -w 1000 " & strComputer)
strPingResults = LCase(objScriptExec.StdOut.ReadAll)


Jai envi de dire "Reponse acceptée" ^^
avec ca tu peu executer tt les commandes dos :D

Si l'informatique été de l'alcool il y aurait des genies partout
3
CCJ Messages postés 565 Date d'inscription mercredi 19 mai 2004 Statut Membre Dernière intervention 30 avril 2008 1
15 mars 2007 à 10:33
Salut.
Renseigne toi sur la fonction Shell

Si l'informatique été de l'alcool il y aurait des genies partout
0
cs_JMO Messages postés 1854 Date d'inscription jeudi 23 mai 2002 Statut Membre Dernière intervention 24 juin 2018 27
15 mars 2007 à 11:28
 Bonjour à tous

Deux exemples pour un ping

strComputer = InputBox("saisir adresse IP",,"192.168.100.12")



On Error Resume Next



Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}!\")._
              ExecQuery("select * from Win32_PingStatus where address = '" & strComputer & "'")
For Each objStatus in objPing
If objStatus.Statuscode = 0 Then
                msgbox "status= " & objStatus.Statuscode,vbInformation,strComputer & " repond au ping !"
        else
                msgbox "status= " & objStatus.StatusCode,vbCritical,strComputer & " n a pas repondu au ping!"
        End If
Next
'------------------------------------------------------------------------

Set objShell = CreateObject("WScript.Shell")
Set objScriptExec = objShell.Exec( _
    "ping -n 2 -w 1000 " & strComputer)
strPingResults = LCase(objScriptExec.StdOut.ReadAll)
If InStr(strPingResults, "perdus = 0") Then
   MsgBox strPingResults,vbInformation,strComputer & " repond au ping !"
Else
   MsgBox strPingResults,vbCritical,strComputer & " na pas repondu au ping!"
End If









jean-marc
0
cs_ghofrane Messages postés 44 Date d'inscription mardi 18 juillet 2006 Statut Membre Dernière intervention 11 août 2009
15 mars 2007 à 18:34
salut
merci les amis pour l'information.
c'est parce que tu le veux et tu le mérite CCJ.
merci pour les codes JMO, c'est très intéressant.
je crois que je vais me plonger dans leur lecture.
merci.
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
CCJ Messages postés 565 Date d'inscription mercredi 19 mai 2004 Statut Membre Dernière intervention 30 avril 2008 1
15 mars 2007 à 18:49
Aucun merite jai juste fais copier coller
Jvais faire un truc correcte alors  :



<html>

<script language="vbscript">
sub Showip_OnClick
Dim objShell,objScriptExec
Set objShell = CreateObject("WScript.Shell")
Set objScriptExec = objShell.Exec( "ipconfig")
strPingResults = LCase(objScriptExec.StdOut.ReadAll)

msgbox strPingResults
end sub
</script>

</html>



voila pr ipconfig =)






Si l'informatique été de l'alcool il y aurait des genies partout
0
Rejoignez-nous