概要
vb.netのコンソールアプリからVBSを実行する
実装
vb
Sub RunVBSFile()
Dim appPath As String = System.Reflection.Assembly.GetExecutingAssembly().Location
Dim appDir As String = System.IO.Path.GetDirectoryName(appPath)
Dim filePath As String = System.IO.Path.Combine(appDir, "test.vbs")
Dim process As New Process()
process.StartInfo.FileName = "cscript.exe"
process.StartInfo.Arguments = filePath
process.Start()
process.WaitForExit()
Dim exitCode As Integer = process.ExitCode
Console.WriteLine("Exit code: " & exitCode)
End Sub