Vb.net 在Visual Basic应用程序中运行批处理作业时无法识别git
我有一个VB应用程序,我想拉下来一个按钮点击回购 单击按钮后,我的项目将运行一个.cmd文件(Frontend.cmd),该文件已保存在我的项目资源文件夹中:Vb.net 在Visual Basic应用程序中运行批处理作业时无法识别git,vb.net,git,batch-file,cmd,Vb.net,Git,Batch File,Cmd,我有一个VB应用程序,我想拉下来一个按钮点击回购 单击按钮后,我的项目将运行一个.cmd文件(Frontend.cmd),该文件已保存在我的项目资源文件夹中: cd .. cd .. cd Users\Username\Documents git clone https://gitusername:token@github.com/repofilepath.git PAUSE 运行Frontend.cmd正常工作,无问题,回购成功撤销。但是,当通过VB应用程序运行.cmd文件时,我得到了git
cd ..
cd ..
cd Users\Username\Documents
git clone https://gitusername:token@github.com/repofilepath.git
PAUSE
运行Frontend.cmd正常工作,无问题,回购成功撤销。但是,当通过VB应用程序运行.cmd文件时,我得到了git不可识别的错误
'git' is not recognized as an internal or external command,
operable program or batch file.
我添加了C:\Program Files\Git\bin\和C:\Program Files\Git\cmd\路径,如本答案中所建议的:
还有其他路径需要我添加吗
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