Powershell Invoke-Item 不再适用于在资源管理器中打开目录

标签 powershell windows-explorer

我经常使用

ii .

在 PowerShell 中打开 Windows 资源管理器中的当前目录。这过去一直有效,但现在没有任何反应。

Invoke-Item cmdlet 仍然有效。执行 ii somefile.txt 在文本编辑器中打开该文件。但是目录不再起作用了。

此外 start . 不起作用。使用 explorer . 确实有效。

运行

Trace-Command -Name ParameterBinding {ii .} -PSHost

返回

DEBUG: ParameterBinding Information: 0 : BIND NAMED cmd line args [Invoke-Item]
DEBUG: ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Invoke-Item]
DEBUG: ParameterBinding Information: 0 :     BIND arg [.] to parameter [Path]
DEBUG: ParameterBinding Information: 0 :         Binding collection parameter Path: argument type [String], parameter type [System.String[]],
collection type Array, element type [System.String], no coerceElementType
DEBUG: ParameterBinding Information: 0 :         Creating array with element type [System.String] and 1 elements
DEBUG: ParameterBinding Information: 0 :         Argument type String is not IList, treating this as scalar
DEBUG: ParameterBinding Information: 0 :         Adding scalar element of type String to array position 0
DEBUG: ParameterBinding Information: 0 :         BIND arg [System.String[]] to param [Path] SUCCESSFUL
DEBUG: ParameterBinding Information: 0 : BIND cmd line args to DYNAMIC parameters.
DEBUG: ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Invoke-Item]
DEBUG: ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: ParameterBinding Information: 0 : CALLING EndProcessing

运行

Trace-Command -Name CommandDiscovery {ii .} -PSHost

返回

DEBUG: CommandDiscovery Information: 0 : Looking up command: ii
DEBUG: CommandDiscovery Information: 0 : Alias found: ii  Invoke-Item
DEBUG: CommandDiscovery Information: 0 : Cmdlet found: Invoke-Item  Microsoft.PowerShell.Commands.InvokeItemCommand,
Microsoft.PowerShell.Commands.Management, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

我想可能存在文件关联问题或其他问题。但我无法弄清楚 Invoke-Item 实际调用的是什么或如何更改它。

我怎样才能让它重新工作?

最佳答案

很难弄清楚为什么它不再适合你,但为什么不使用在 powershell 和 cmd 中相同的替代方法:

start .

(explorer . 也可以)

如果 ii . 很重要,请尝试重新启动 Powershell 控制台和/或计算机。也尝试做 ii 。 -whatif 看看你是否得到任何关于为什么它不再起作用的线索。

关于Powershell Invoke-Item 不再适用于在资源管理器中打开目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10141357/

相关文章:

javascript - 是否可以使用 JavaScript 对 HTA 执行 Windows 资源管理器搜索?

sharepoint - 使用 PowerShell 在 SharePoint 中检索已部署解决方案的详细信息

powershell - 如何让 PowerShell 提示未签名的脚本

powershell - 打开文件夹并最大化文件夹窗口

installshield - 由于win资源管理器指向的目标发布文件夹,ISDEV fatal error -1014的任何自动解决方案?

c# - 如何从 WPF 应用程序中将 Windows 资源管理器打开到特定目录?

amazon-web-services - 如何将AWS S3同步输出重定向到文件?

powershell - 如何使用bat文件从启动/自动启动文件夹运行Powershell脚本?

icons - 在 Windows 资源管理器中显示 exe 的图标时,Windows 如何决定要显示的图标格式?

windows - 将自定义 "new folder"添加到 Windows 资源管理器上下文菜单