【问题标题】:VB.net, my code unable to run bat fileVB.net,我的代码无法运行 bat 文件
【发布时间】:2018-03-13 16:19:18
【问题描述】:
Dim app As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
    If System.IO.Directory.Exists(app & "\Divers") Then
        Try
            Process.Start(app & "\Divers\b.bat")
            cs.Text = "OK"
            cs.Refresh()
        Catch ex As Exception
            eror.Text = "(B) Problems"
            cs.Text = "error"
        End Try
        Try
            Process.Start(app & "\Divers\Realtek\diver.exe")
            d.Text = "OK"
        Catch ex As Exception
            DebugLog()
            error.Text = "Driver Problems"
            cs.Text = "error"
        End Try
        Try
            Process.Start(app & "\Divers\a.bat")
            CVS.Text = "OK"
        Catch ex As Exception
            error.Text = eror.Text & "(A) Problems"
            cs.Text = "error"
        End Try

那是我的代码家伙,但 bat 文件不起作用。已打开但什么也不做,如果我打开 bat 文件手册(用鼠标和双击逻辑!!!)它的工作。请帮忙

【问题讨论】:

  • 你见过this questionaccepted answer吗?
  • 代码在 .Start 部分进行吗?文件是否执行但不正确?也许 WorkingDirectory 现在不是正确的,它可以在不同的文件夹下执行。
  • 你应该在你的应用中的某处显示ex.Message的内容。

标签: vb.net file batch-file process startup


【解决方案1】:

您的批处理文件可能基于working directory 工作,并且由于您使用不同文件夹中的软件运行批处理文件,批处理文件的working directory 不匹配。

将您的软件放入批处理文件夹,然后重试。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-09-07
    • 1970-01-01
    • 1970-01-01
    • 2021-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多