如何使用powershell打开URL,如;imacros://run/?m=my_saved_macro.iim"?

如何使用powershell打开URL,如;imacros://run/?m=my_saved_macro.iim"?,powershell,imacros,Powershell,Imacros,打开一个典型的URL,如http://www.google.com在PowerShell中,我们可以使用以下内容: start http://www.google.com 然而,为了实现自动化,有时我需要像imacros://run/?m=my_saved_macro.iim。如果您需要详细信息,可以转到 当我尝试PowerShell代码启动时imacros://run/?m=my_saved_macro.iim,我收到以下错误: start : This command cannot be

打开一个典型的URL,如
http://www.google.com
在PowerShell中,我们可以使用以下内容:

start http://www.google.com
然而,为了实现自动化,有时我需要像
imacros://run/?m=my_saved_macro.iim
。如果您需要详细信息,可以转到

当我尝试PowerShell代码
启动时imacros://run/?m=my_saved_macro.iim
,我收到以下错误:

start : This command cannot be run due to the error: Unknown error (0x80041002).
At c:\temp\test.ps1:51 char:5
+     start "imacros://run/?m=$macro_file_name";
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
我想知道如何在PowerShell的默认浏览器中打开此类URL


谢谢。

您应该能够使用
启动流程
cmdlet,如下所示:

Start-Process $URI
如果您需要更多的控制,您可以进入.NET API进行处理,并使用以下修改之一:

[System.Diagnostics.Process]::Start($URI)