我经常遇到wifi问题,所以我决定创建一个Python 3脚本,在Windows 10命令行工具上执行以下命令:
ipconfig/flushdns
ipconfig/release
ipconfig/renew据我所知,我需要使用os模块或子流程模块来使其工作。我只是不知道如何在调用ipconfig之后执行这些命令。
谢谢你的帮助。
发布于 2018-01-22 11:39:34
您可以为此使用subprocess.call方法。
import subprocess
print subprocess.call(["ipconfig", "/flushdns"], shell=True)
print subprocess.call(["ipconfig", "/release"], shell=True)
print subprocess.call(["ipconfig", "/renew"], shell=True)https://stackoverflow.com/questions/48379086
复制相似问题