Powershell循环冻结,不需要输入时等待输入
我有一个 powershell 脚本,它在连接到服务器时循环,并检查某些作业是否已完成。它会进行检查,休眠 60 秒,然后再次检查。该脚本将继续检查,直到找不到作业为止。
然而,脚本有时会无缘无故地挂起。如果我按回车键,它会再次启动。整个脚本中没有任何输入。我绝对不会从主人那里拿走任何东西。为什么会这样做?我该如何预防?如果我必须无缘无故地随机按回车键,这对自动化来说是没有好处的。
顺便说一句,我正在使用 Powershell 2.0。
提前致谢
I have a powershell script that is looping while connecting to server, and checking to see if some jobs are done. It checks, sleeps for 60 seconds and then checks again. The script will keep checking until no jobs are found.
However, every now and then, the script just hangs for no reason. If I hit enter, it starts up again. There is no input in this entire script. At no point do I grab anything from the host. Why is it doing this and how can I prevent it? It's no good for automation if I have to randomly hit enter for no reason.
BTW, I am using Powershell 2.0.
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它在控制台窗口中运行吗?如果是这样,您是否已成功启动选择(用鼠标):标题应该已更改为启动“选择”。
选择时控制台窗口被冻结...并且如果只选择一个字符单元格,则很难发现...
Is it running in a Console window? If so have you managed to start a select (with the mouse): the title should have changed to start "Select".
When selecting the console window is frozen... and if only one character cell is selected it can be hard to spot...