LoginSignup
18
19

More than 5 years have passed since last update.

Pythonでコマンドを叩く(Windows)

Posted at

コマンドプロンプトを叩いたようにコマンドを実行するPython。


# coding:utf-8
import os

cmd = "ipconfig /all > D:\\ipconfig.txt"
os.system(cmd)

cmd = "tree D:\\Doc /f > D:\\tree.txt"
os.system(cmd)

実行ファイルにすれば.batみたいに配布できる。

もっと賢い書き方があったら教えて下さい。

いじょ

18
19
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
19