Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net Can';t launch.exe_Vb.net - Fatal编程技术网

Vb.net Can';t launch.exe

Vb.net Can';t launch.exe,vb.net,Vb.net,试图制作一个“魔兽世界”发射器 工作原理: 当您按“启动Authserver”时,您可以找到Authserver.exe。然后保存位置,这样您就不必重复该操作两次。 一旦按下,它显然应该启动authserver.exe 发生了什么: 当您按下“启动Authserver”时,它会打开并立即关闭,出现错误: 错误,无法打开,因为找不到authserver.conf 注意: Authserver.exe和Authserver.conf在同一个文件夹中,我可以手动启动它 Mort昨天帮我解决了类似的问题

试图制作一个“魔兽世界”发射器

工作原理: 当您按“启动Authserver”时,您可以找到Authserver.exe。然后保存位置,这样您就不必重复该操作两次。 一旦按下,它显然应该启动authserver.exe

发生了什么: 当您按下“启动Authserver”时,它会打开并立即关闭,出现错误: 错误,无法打开,因为找不到authserver.conf

注意: Authserver.exe和Authserver.conf在同一个文件夹中,我可以手动启动它

Mort昨天帮我解决了类似的问题,我希望同样的VB代码也能工作,因为这看起来很明显

Private filePath As String = String.Empty

Private Sub PlayButton_Click(sender As System.Object, e As System.EventArgs) Handles PlayButton.Click
    Try
        If filePath.Length = 0 Then
            Dim diagResult As DialogResult = OpenFileDialog1.ShowDialog()
            If diagResult = Windows.Forms.DialogResult.OK Then
                filePath = OpenFileDialog1.FileName
                If filePath.ToUpper.EndsWith("WOW.EXE") Then
                    Process.Start(filePath)
                Else
                    MessageBox.Show("Wrong file selected!")
                    filePath = String.Empty
                End If
            End If
        Else
            Process.Start(filePath)
        End If

    Catch ex As Exception
        MessageBox.Show(String.Concat("An error occurred in the play button click:", ex.Message))
    End Try

End Sub
有人有主意吗?
提前:谢谢。

试试这样:

Private-Sub-PlayButton\u单击(发送方作为System.Object,e作为System.EventArgs)处理PlayButton。单击
尝试
OpenFileDialog1.FileName=“”
OpenFileDialog1.Filter=“魔兽世界(WOW.EXE)| WOW.EXE”
Dim diagResult As DialogResult=OpenFileDialog1.ShowDialog
如果diagResult=Windows.Forms.DialogResult.OK,则
dimp作为一种新工艺
Dim fn作为新的System.IO.FileInfo(OpenFileDialog1.FileName)
p、 StartInfo.WorkingDirectory=fn.DirectoryName
p、 StartInfo.FileName=fn.Name
p、 开始()
如果结束
特例
Show(String.Concat(“播放按钮单击时出错:”,例如Message))
结束尝试

End Sub
尝试以下方法:

Private-Sub-PlayButton\u单击(发送方作为System.Object,e作为System.EventArgs)处理PlayButton。单击
尝试
OpenFileDialog1.FileName=“”
OpenFileDialog1.Filter=“魔兽世界(WOW.EXE)| WOW.EXE”
Dim diagResult As DialogResult=OpenFileDialog1.ShowDialog
如果diagResult=Windows.Forms.DialogResult.OK,则
dimp作为一种新工艺
Dim fn作为新的System.IO.FileInfo(OpenFileDialog1.FileName)
p、 StartInfo.WorkingDirectory=fn.DirectoryName
p、 StartInfo.FileName=fn.Name
p、 开始()
如果结束
特例
Show(String.Concat(“播放按钮单击时出错:”,例如Message))
结束尝试

End Sub
您可能有错误的工作目录。请使用
Process.StartInfo.WorkingDirectory
告诉它从哪里开始刚才选中的,目录是正确的。我对VB非常陌生,我应该把它放在哪里?你可能有错误的工作目录。使用
Process.StartInfo.WorkingDirectory
告诉它从哪里开始刚才检查过,目录是正确的。我对VB很陌生,我应该把它放在哪里?