[英]start a simple batch file to run a python script then terminate the cmd window
I have a simple batch file which has: 我有一个简单的批处理文件,其中包括:
python mySript.py
I save the file as .bat
, I run it, everything is fine except the cmd window stays. 我将文件另存为
.bat
,运行它,除了cmd窗口保留之外,一切都很好。 I tried many solutions, but nothing worked. 我尝试了许多解决方案,但没有任何效果。
The python script is a tkinter app, and I want to get the app window only when I run the batch file, not the cmd window (should close automtically after running the batch) python脚本是tkinter应用程序,我只想在运行批处理文件时获取应用程序窗口 ,而不是cmd窗口(运行批处理后应自动关闭)
Btw, I tried also START \\b
, but that didn't help. 顺便说一句,我也尝试了
START \\b
,但这没有帮助。
When reading the help, via cmd.exe
for start /?
阅读帮助时,可通过
cmd.exe
来start /?
you will see the first line states: 您将看到第一行状态:
Starts a separate window to run a specified program or command.
启动一个单独的窗口以运行指定的程序或命令。
So all you need to do is: 因此,您需要做的是:
start "" python mySript.py
Which will launch the python script and directly exit the batch file, if launched by double click. 如果双击启动,它将启动python脚本并直接退出批处理文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.