call OpenFileDialog from powershell

前端 未结 3 734
情书的邮戳
情书的邮戳 2021-02-03 14:54

When I run the following, PowerShell hangs waiting for the dialog to close, even though the dialog is never displayed:

[void] [Reflection.Assembly]::LoadWithPart         


        
3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-03 15:22

    Apparently this has something to do with Multi-Threaded Apartment (MTA) mode. It appears to work fine in Single-Threaded Apartment (-STA) mode.

    See also: Could you explain STA and MTA?

提交回复
热议问题