magazinetotal.blogg.se

Command prompt pops up then closes
Command prompt pops up then closes




command prompt pops up then closes command prompt pops up then closes

py script and launches a new command prompt to run the script you double clicked.

command prompt pops up then closes

This runs every time you double click any. #Run a python script in a new command prompt that does not closeĬommand = 'start cmd /k C:\Python37\python.exe "' + sys.argv + '"' pyw files to pythonw.exe (not python.exe) through Windows if they aren't already. Change the path C:\Python37\python.exe to the location of your python installation. The code required may differ for other versions. Now, for the implementation, I call the initial python script python_cmd_k.pyw. One possibly undesirable side effect is dragging and dropping or typing and running from a command prompt now opens a second command prompt rather than running in the command prompt you dragged or typed in. Maybe there are good reasons not to do this, those with more knowledge please comment if so, but I figure if I run into any it is easy to revert back if needed. The initial script launches a new command prompt window with the /k parameter which keeps the command prompt open after completion and runs your intended script in the new window. py files so they run a separate initial script before running the intended script. I guess I'm too lazy to drag and drop or type when I don't need to so after some experimentation I came up with a solution. I couldn't find anywhere on the internet a true non-script specific, double click and the window doesn't close solution.






Command prompt pops up then closes