0

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

Btw, I tried also START \b, but that didn't help.

9
  • Don't know if it helps, but have a look here for possible solutions: stackoverflow.com/questions/14626178/… Commented Feb 22, 2019 at 10:31
  • I already tried this one, but didn't help also. But thanks for the comment anyway Commented Feb 22, 2019 at 10:33
  • exit? Commented Feb 22, 2019 at 10:37
  • exit doesn't help, because it stucks at the line python mySript.py, it waits for it to finish Commented Feb 22, 2019 at 10:40
  • 2
    start "" pythonw mySript.py Commented Feb 22, 2019 at 10:47

1 Answer 1

3

When reading the help, via cmd.exe for 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.

Sign up to request clarification or add additional context in comments.

1 Comment

Wow, this one worked for me. Thought I'd tried everything!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.