$source = '
Function ShowMsg(ByVal msg)
MsgBox(msg)
End Function
'
$sc = New-Object -comObject MSScriptControl.ScriptControl
$sc.Language = 'VBScript'
$sc.AddCode($source)
$sc.CodeObject
作成 2010.01.05
更新 2011.11.27
更新 2011.11.27
PowerShell で他言語を使用する VBScript編
このサンプルは、PowerShell V2 以上で動作します。
本体
test.ps1
実行
呼び出して実行
$code = .\test.ps1
$code.ShowMsg("test")
タグ: PowerShell
VBScript