Powershell why popup window, how to stop it

旧城冷巷雨未停 提交于 2020-01-03 03:34:10

问题


Not sure why when I execute a Python tools like pip or nosetests inside powershell, a separate popup command line windows will show, execute my command, then disappeared. This is annoying because I can hardly see the executable output, especially the last few lines before the popup close.

I assume there are some setting I can change to stop the popup?

I am using Powershell 2.0 in Windows 7.


回答1:


Powershell is not cmd.exe, and it has a different console interface. More than likely, your py tools are writing to a non-existent shell window. You may be able to get around this by using the following syntax:

cmd /c script.py

What you do when you execute the python scripts directly from the PS prompt is fire-off a DOS shell for the period of time it takes for the command to complete. Since there's no 'pause' implemented, the shell window closes when the command completes.

A test script

# tester.py, just a test
print "This is a test script, that is all."

Output in PS:

C:\src\python
{powem} [36] --> .\tester.py
C:\src\python
{powem} [37] --> cmd /c .\tester.py
This is a test script, that is all.

mp




回答2:


For someone has similar problem, please have a look at this answer, I think this solution eventually solved my problem. and in my case, I have to restart my computer to get it all working.



来源:https://stackoverflow.com/questions/12134082/powershell-why-popup-window-how-to-stop-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!