我正在制作一个小批量文件来从git中提取。我使用以下内容:
call git pull origin master
但是当命令的响应为Already up-to-date.
我该怎么做?
答案 0 :(得分:2)
将其传输到findstr
,然后检查错误级别
git pull | findstr /C:"Already up-to-date"
IF %errorlevel%==0 GOTO:EOF
echo Continuing ....
解释findstr
与errorlevel
http://ss64.com/nt/findstr.html的关系说:
FINDSTR will set %ERRORLEVEL% as follows:
0 (False) a match is found in at least one line of at least one file.
1 (True) if a match is not found in any line of any file, (or if the file is not found at all).
2 Wrong syntax
An invalid switch will only print an error message in error stream.