Thursday, February 23, 2017

Using Shell.Application in PowerShell

If you're translating VBScript to PowerShell, you'll almost certainly run across a CreateObject("Shell.Application") call. The PowerShell equivalent is surprisingly easy, much more convenient than in a compiled .NET language:

New-Object -ComObject 'Shell.Application'

The resulting object's methods are all there as expected and can even be tab-completed.

Other COM objects can be similarly instantiated.

No comments:

Post a Comment