KML未通过VB.net在Google Earth中打开
我正在编写一个应用程序,使用安装在我电脑上的Google earth打开KML文件。但我的代码找不到该文件 这是我的代码:KML未通过VB.net在Google Earth中打开,vb.net,kml,google-earth,Vb.net,Kml,Google Earth,我正在编写一个应用程序,使用安装在我电脑上的Google earth打开KML文件。但我的代码找不到该文件 这是我的代码: Public Class openkml Sub kmlopener() Dim ge As String Dim gf As String ge = "C:\Program Files (x86)\Google\Google Earth\client\googleearth.exe" gf = "C:
Public Class openkml
Sub kmlopener()
Dim ge As String
Dim gf As String
ge = "C:\Program Files (x86)\Google\Google Earth\client\googleearth.exe"
gf = "C:\Program Files (x86)\Google\Google Earth\client\abc.kml"
Process.Start(ge, gf)
End Sub
End Class
此外,只需在命令行DOS中键入以下内容即可打开文件:
"C:\Program Files (x86)\Google\Google Earth\client\googleearth.exe" abc.kml
文件存在于提到的位置。Google earth将打开,但找不到该文件。我也将kml文件放在了不同的目录中,就像D目录一样,但显示了相同的错误。下面是错误的屏幕截图
问题在于路径中的空间。您可以在参数中添加引号,它应该可以工作:
gf = """C:\Program Files (x86)\Google\Google Earth\client\abc.kml"""
谢谢这是我真正的问题。