我有一个.bat文件,在我做的文件中:
to-csv.vb
程序我被困在第6步。这是我的代码:
cd "Python\test1"
copy "Python\test1\"*.xls* "Python\test1\move"
FOR /f "delims=" %%i IN ('DIR *.xls* /b') DO to-csv.vbs "%%i" "%%i.csv"
del "H2*.csv"
del "H6*.csv"
del "H3*.xlsx"
cd "H:\UCLAHealth\HIIN\Data Process\Python" #my python script1 is in this directory
python script1.py #this line didn't work.
我已经完成了第1-5步,但仍然坚持第6步。在.bat文件中运行Python脚本的正确语法是什么?
答案 0 :(得分:2)
您可以在脚本中执行此操作:
set "python=C:\path to Python\python.exe"
"%python%" script1.py
或者您可以使用完整路径执行它:
"C:\Path to Python\python.exe" script1.py