Python

Résolu/Fermé
Theodose3 Messages postés 26 Date d'inscription mercredi 12 août 2015 Statut Membre Dernière intervention 29 novembre 2017 - Modifié le 28 nov. 2017 à 18:35
Theodose3 Messages postés 26 Date d'inscription mercredi 12 août 2015 Statut Membre Dernière intervention 29 novembre 2017 - 28 nov. 2017 à 18:44
Bonjour,
Je suis en train de faire un petit script qui execute une commande dos sous python , mais je n'arrive pas a rediriger le contenue de la commande vers un .txt
Any help please ?

Mon script :

import os
print('[+] Choice : ')
print('1 -ipconfig-')
choice = int(input())
if choice == 1:
os.system("ipconfig/all")
sortie = os.popen("ipconfig/all")

1 réponse

jordane45 Messages postés 38138 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 17 avril 2024 4 649
28 nov. 2017 à 18:38
Bonjour,

ceci devrait fonctionner

os.system("ipconfig/all >tonfichier.txt")

0
Theodose3 Messages postés 26 Date d'inscription mercredi 12 août 2015 Statut Membre Dernière intervention 29 novembre 2017
28 nov. 2017 à 18:44
Top merci
0