简体   繁体   中英

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. 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.

cd %~dp0
START /B .\Modules\monitor.pyw

However, this method does not appear to work when I explicitly specify the Python executable like so:

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. But I suppose that a switch is needed on starting python.exe in Windows GUI mode or a different application.

I suggest to look which command is configured in Windows registry for opening a *.pyw file.

According to reply by ghostdog74 on What is the difference between .py and .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.

So you have to change the command line by inserting character w .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM