Hello, COM(PowerShell) World!

Posted on 5月 16th, 2012 by cx20

COM(PowerShell)

COM(Component Object Model)はマイクロソフトの提唱するプログラム部品の仕様である。
COM を用いて開発された部品であれば言語を問わず利用することができる。
以下は PowerShell による COM クライアント(実行時バインディング)の例となっている。

ソースコード

$ssfWINDOWS = 36
 
function Main() {
    $shell = new-object -comobject Shell.Application
    $folder = $shell.BrowseForFolder( 0, "Hello, COM(PowerShell) World!", 0, $ssfWINDOWS )
}
 
Main

実行方法

C:¥> PowerShell -File hello.ps1

実行結果

+----------------------------------------+
|Browse For Folder                    [X]|
+----------------------------------------+
| Hello, COM(PowerShell) Wolrd!          |
|                                        |
| +------------------------------------+ |
| |[Windows]                           | |
| | +[addins]                          | |
| | +[AppCompat]                       | |
| | +[AppPatch]                        | |
| | +[assembly]                        | |
| |     :                              | |
| |     :                              | |
| |     :                              | |
| +------------------------------------+ |
| [Make New Folder]    [  OK  ] [Cancel] |
+----------------------------------------+

Tags:

Categories: COM, library, PowerShell

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

WP-SpamFree by Pole Position Marketing