[英]Executing git commands from windows batch file, C#
我正在嘗試編寫小型git客戶端,我只想使用git pull和git clone命令。
我正在這樣做:
Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "path to my.bat";
p.Start();
string output = p.StandardOutput.ReadToEnd();
p.WaitForExit();
bat文件可以正常工作並執行簡單的命令,但是我想從該bat文件執行git命令,並且無法識別git。
有什么正確的方法嗎?
在您的批處理文件中添加一行
path
並檢查輸出是否包含包含git.exe文件的目錄。 如果沒有,請指定git.exe文件的完整路徑。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.