1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Sub AffichContenu()
Dim Question,Titre,strcommand,Resultat
Set WshShell = CreateObject("WScript.Shell" )
Titre = "AffichContenu"
strcommand1 = "& Dir"'commande1 a passer pour lister le contenu de C:\
Strcommand2 = "& Dir > c:\contenu.txt"'Commande2 a passer avec redirection dans le fichier c:\contenu.txt
Question = MsgBox("Voulez-vous afficher le contenu de votre lecteur C:\ ?", vbOKCancel+32,Titre)
If Question = vbOK Then
Command1 = "CMD /K CD c:\ "& strcommand1 &""
Command2 = "CMD /C CD c:\ "& strcommand2 &""
MsgBox Command1 & vbcr & Command2,64,Titre
Resultat1 = WshShell.Run(Command1,1,True)' avec affichage du la fenêtre Dos
Resultat2 = WshShell.Run(Command2,0,True)' sans affichage du la fenêtre Dos
else
exit sub
End If
End Sub
Call AffichContenu |
Partager