How to use powershell to open a URL like "imacros://run/?m=my_saved_macro.iim"?

1

To open a typical URL like http://www.google.com from PowerShell, we can use something like:

start http://www.google.com

However, to automate imacros, sometimes I need open URLs like imacros://run/?m=my_saved_macro.iim. You can go to here if you want the details.

When I try the PowerShell code start imacros://run/?m=my_saved_macro.iim, I got the following error:

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

I want to know how to open this kind of URL in the default browser from PowerShell.

Thanks.

powershell
imacros
asked on Stack Overflow Jan 6, 2014 by user133580

1 Answer

1

You should be able to use the Start-Process cmdlet like so:

Start-Process $URI

If you need even more control, you can go into the .NET API for Process and use one of the modifications of this:

[System.Diagnostics.Process]::Start($URI)
answered on Stack Overflow Jan 7, 2014 by Eris

User contributions licensed under CC BY-SA 3.0