LoginSignup
2
5

More than 5 years have passed since last update.

windowsバッチ処理でPythonスクリプトを実行

Last updated at Posted at 2017-09-24

pythonファイルbatファイルで、実行させたい時に必要な処理。

後は自動起動させるなりタスクスケジューラに入れるなりすると、
該当スクリプトが実行されます。

環境:
PC:windows 10 PRO
python:python3.4
ファイル名:test.bat
実行ファイル:test.py

【要点】
1.windows のpython.exeをインストールすれば、c:\python34 or c:\python27に実行
ファイルが作成される。
2. python 2.7でも34の箇所を27にすれば問題無し。

【中身(test.bat)】

↓ここから
cd /d %~dp0
C:\Python34\python.exe C:/Users/UserName/test.py %*
cd
pause
↑ここまで

2
5
0

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
2
5