1

I have a VB app that I want to pull down a repo upon a button click.

Upon button click, my project runs a .cmd file (Frontend.cmd) that I have saved in my project resources folder:

cd ..
cd ..
cd Users\Username\Documents
git clone https://gitusername:token@github.com/repofilepath.git
PAUSE

Running Frontend.cmd normally works without issue, the repo is pulled down successfully. However, when running the .cmd file through the VB application, I get the git is not recognized error.

'git' is not recognized as an internal or external command,
operable program or batch file.

I have added C:\Program Files\Git\bin\ and C:\Program Files\Git\cmd\ paths as suggested in this answer: 'git' is not recognized as an internal or external command

Is there another path I must add?

Here is my button click code if needed:

        Dim output As String
        output = My.Resources.Frontend
        Dim programPath As String = Path.GetTempPath & “\” & program & ".cmd"
        Using sw As StreamWriter = New StreamWriter(programPath)
            sw.Write(output)
        End Using
        If (My.Computer.FileSystem.FileExists(programPath)) Then
            Dim procStartInfo As New ProcessStartInfo
            Dim procExecuting As New Process

            With procStartInfo
                .UseShellExecute = True
                .FileName = programPath
                .WindowStyle = ProcessWindowStyle.Normal    'use .hide to hide the process window
                .Verb = "runas"                             'run as admin
            End With
            MsgBox("Please press Yes when system ask permissions", MsgBoxStyle.Information, "myProgram")
            procExecuting = Process.Start(procStartInfo)

        End If
JustReflektor
  • 95
  • 3
  • 13

0 Answers0