LoginSignup
0
0

More than 1 year has passed since last update.

【vb.net】VBSを実行

Last updated at Posted at 2023-01-22

概要

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
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0