尋找VB發佈的路徑 ClickOnce 應用程式

http://msdn.microsoft.com/zh-tw/library/system.deployment.application.applicationdeployment_members(v=VS.90).aspx

命名空間:System.Deployment.Application

類別:ApplicationDeployment

屬性:DataDirectory 取得 ClickOnce 資料目錄的路徑

 =>要發佈後執行,才會跳出程式的版本或是路徑

但顯示路徑是datadirectory,並不是執行檔的路徑。

可愛聰明我寫就寫了一段程式判斷修改日期是最新的程式,就執行shell那個檔案的路徑。

Dim strDirectoryName As String = "C:\Documents and Settings\lotus\Local Settings\Apps\2.0\"

            Dim fs, f As Object
            Dim MaxFile As String = ""
            Dim update As Date

            For Each foundFile As String In My.Computer.FileSystem.GetFiles(strDirectoryName, FileIO.SearchOption.SearchAllSubDirectories, "Progress.exe")

                fs = CreateObject("Scripting.FileSystemObject")
                f = fs.GetFile(foundFile)

                If Date.Compare(f.DateLastModified(), update) > 0 Then
                    update = f.DateLastModified()
                    MaxFile = foundFile
                End If
            Next

                 Shell(MaxFile.ToString())

arrow
arrow
    文章標籤
    vb shell ClickOnce
    全站熱搜

    雀悦 發表在 痞客邦 留言(0) 人氣()