none
VB.net建立捷徑在桌面上 RRS feed

  • 問題

  • Public Class Form1
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            CreateShortCut("C:\Program Files (x86)\Google\Chrome\Application\", "chrome.exe", "捷徑描述")
        End Sub
    
        Sub CreateShortCut(ByRef strFolder As String, ByRef strExe As String, ByRef strName As String)
            Dim sc, objWS As Object
            objWS = CreateObject("WScript.Shell")
            With objWS
                sc = .CreateShortCut(.SpecialFolders("Desktop") & "\" & Replace(strExe, ".EXE", ".LNK", 1, , 1))
            End With
            With sc
                .TargetPath = objWS.ExpandEnvironmentStrings(strFolder & "\" & strExe)
                .WorkingDirectory = strExe
                .Description = strName
                .WindowStyle = 4
                .IconLocation = objWS.ExpandEnvironmentStrings(strFolder & "\" & strExe & ",0")
                .Save()
            End With
        End Sub
    
    End Class
    

    如何把" www.google.com"" --profile-directory="Profile 1"的部份寫到程式?我有試過加 & 但不行,全句是:

    "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" www.google.com"" --profile-directory="Profile 1"

    2019年7月29日 下午 02:49

解答

所有回覆