powershell-2.0 - Powershell ISE 似乎与交互式命令挂起。

标签 powershell-2.0

我刚刚下载了 Powershell 2.0 并且我正在使用 ISE。总的来说,我真的很喜欢它,但我正在寻找解决问题的方法。有很多交互式的遗留命令。例如 xcopy如果被告知覆盖文件,默认情况下将提示用户。

在 Powershell ISE 中,这似乎挂起

mkdir c:\tmp                                                                                       
cd c:\tmp                                                                                          
dir > tmp.txt                                                                                      
mkdir sub                                                                                          
xcopy .\tmp.txt sub # fine
xcopy .\tmp.txt sub # "hang" while it waits for a user response.

第二个xcopy正在提示用户授予覆盖权限 C:\tmp\sub\tmp.txt ,但在 ISE 输出窗口中不显示提示。
我可以从 cmd.exe 正常运行,但是 ISE 有什么用?我怎么知道什么时候需要哪一个?

最佳答案

简而言之,ISE 不支持交互式控制台应用程序(请参阅下面的链接)。作为一种解决方法,您可以通过首先使用 test-path 检查文件是否存在来“防止”复制项目覆盖文件。

http://blogs.msdn.com/powershell/archive/2009/02/04/console-application-non-support-in-the-ise.aspx

关于powershell-2.0 - Powershell ISE 似乎与交互式命令挂起。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1773108/

相关文章:

tfs - 运行位于 TFS 源代码管理中的 Powershell 脚本

powershell - 具有多个ParameterSetName的函数中的AmbiguousParameterSet

powershell - 测试PowerShell中是否存在文件

powershell - 我可以将 Powershell 4 与 Powershell 3 并排安装吗?

powershell - 如何从 powershell 在另一个应用程序窗口中运行交互式命令

powershell - 在PowerShell中获取文件的完整路径

powershell - 选择对象省略了选择字符串Powershell的输出

powershell - 如何在 powershell 中使用 GetWindowText API 函数?

powershell-2.0 - 如何为我的 cmdlet 编写 Powershell 帮助

.net - 如何将字符串拆分为不带多个空格的字符串数组