简体   繁体   English

在python中运行CMD代码行,在终端Anaconda中查看结果

[英]Run CMD code line in python, see results in terminal Anaconda

I have this simple code I use to convert files with handbrake我有这个简单的代码,用于使用手刹转换文件

"C:\Program Files\HandBrake\HandBrakeCLI.exe" -i c:\folder -o c:\folder2 --preset-import-file "D:\Handbreak\Script\dudeness.json"

I want to run this line in python and see the output it generates in the terminal我想在 python 中运行这一行并查看它在终端中生成的输出

My Intention is to iterate "C:\\folder" and "c:\\folder2"我的意图是迭代 "C:\\folder" 和 "c:\\folder2"

First,第一的,

import os
os.system("your command")

You can then use a cmd script to run python script然后您可以使用 cmd 脚本来运行 python 脚本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在cmd中运行python和anaconda python - Run python and anaconda python in cmd VS CODE,如何在 OS 终端中运行 python? (壳牌或 CMD) - VS CODE, how run python in OS terminal ? (Shell or CMD) 代码可在 Anaconda 上运行,但不能通过 cmd 在 Python 上运行 - Code works on Anaconda but not on Python through cmd 通过anaconda提示符执行python代码时,导入numpy起作用,但通过cmd运行时产生错误 - Import numpy works when python code executed through anaconda prompt but produces an error when run through cmd 使用Py2app在需要cmd行参数的终端中生成/运行Python可执行文件 - Build/Run Python Executable in terminal that requires cmd line arguments using Py2app 带有 Anaconda 的 VSCode 在终端中的运行中找到模块,但在运行代码或调试器中找不到 - VSCode with Anaconda finds module in Run in Terminal but not in Run code or debugger 在cmd中使用Anaconda Python - Using Anaconda Python in cmd Python 脚本在 anaconda3 上运行时无法在 cmd 上运行 - Python script doesn't run on cmd when it runs on anaconda3 Python 底图脚本与 Anaconda cmd 提示符一起运行,但不与 VS Code 一起运行 - Python Basemap script runs with Anaconda cmd prompt but not with VS Code 这是自动打开 cmd 线并运行工具并返回结果 python 3.6 的好方法吗 - is this a good approach to automate opening cmd line and run a tool and return results python 3.6
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM