[检查文件是否存在]
Process.Start(@"F:\autorun.inf");
编辑:抱歉,自动运行似乎是一个资源管理器功能。您必须自己分析文件。
Const DVD_DRIVE As String = "E:\"
If IO.File.Exists(DVD_DRIVE & "autorun.inf") Then
Dim textreader As New IO.StreamReader(DVD_DRIVE & "autorun.inf")
Dim sLine As String = ""
sLine = textreader.ReadLine()
Do While Not String.IsNullOrEmpty(sLine)
If sLine.StartsWith("open=") Then
Dim applicationstring As String
Dim autorunapp As New Process()
Dim startinfo As ProcessStartInfo
applicationstring = sLine.Substring(5)
startinfo = New ProcessStartInfo(DVD_DRIVE & applicationstring)
startinfo.WorkingDirectory = DVD_DRIVE
autorunapp.StartInfo = startinfo
autorunapp.Start()
Exit Do
End If
sLine = textreader.ReadLine()
Loop
textreader.Close()
End If