[英]Windows batch script START /B not working
I have created a batch script in order to start a custom Python script that I am running on Windows. 我创建了一个批处理脚本,以启动我在Windows上运行的自定义Python脚本。 However, what I could like to do is not have the command line window appear.
但是,我想做的是没有出现命令行窗口。
I did some research and I found that if I used the prefix START /B, the command line window will now appear. 我进行了一些研究,发现如果使用前缀START / B,现在将显示命令行窗口。
cd %~dp0
START /B .\Modules\monitor.pyw
However, this method does not appear to work when I explicitly specify the Python executable like so: 但是,当我像这样显式指定Python可执行文件时,此方法似乎不起作用:
cd %~dp0
START /B .\Python27\python .\Modules\monitor.pyw
The question is, why does the line above not work in the same way as the line with the explicit executable path? 问题是,为什么上面的行不能与具有显式可执行路径的行以相同的方式工作? Thanks!
谢谢!
I do not have Python installed. 我没有安装Python。 But I suppose that a switch is needed on starting
python.exe
in Windows GUI mode or a different application. 但是我想在Windows GUI模式或其他应用程序中启动
python.exe
时需要进行切换。
I suggest to look which command is configured in Windows registry for opening a *.pyw file. 我建议看看Windows注册表中配置了哪个命令来打开* .pyw文件。
According to reply by ghostdog74 on What is the difference between .py and .pyw? 根据ghostdog74的回复。.py 和.pyw有什么区别? I'm right with my assumption.
我的假设是正确的。
*.pyw must be interpreted with pythonw.exe
instead of python.exe
to run the Python script in Windows GUI mode instead of console mode. * .pyw必须使用
pythonw.exe
而不是python.exe
解释, pythonw.exe
在Windows GUI模式而不是控制台模式下运行Python脚本。
So you have to change the command line by inserting character w
. 因此,您必须通过插入字符
w
来更改命令行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.