gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 15:05:15 24 4
gpt4 key购买 nike

我刚刚下载了 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com