0
完成我有一些蝙蝠文件等待的过程中批处理文件
@echo off
call git clone ssh://[email protected]/~/repo/site C:\git\project
:end
我怎样才能获得成功克隆项目的回调,并开始下一个终端程序?
或者我需要使用另一个东西,可能是PowerShell?
完成我有一些蝙蝠文件等待的过程中批处理文件
@echo off
call git clone ssh://[email protected]/~/repo/site C:\git\project
:end
我怎样才能获得成功克隆项目的回调,并开始下一个终端程序?
或者我需要使用另一个东西,可能是PowerShell?
您可以使用ERRORLEVEL看是否最后一个命令失败或不
这样
if %ERRORLEVEL% == 0 GOTO continue
if %ERRORLEVEL% == 1 GOTO error
:continue
echo do what you want here after successfully cloned
goto exit
:error
echo do your error handling here
:exit
在poweshell你可以可以调用命令,然后检查$lastexitcode
变量,如果命令完成它会如果它失败,则为0
,它将为1
。使用简单的if
你可以处理如下:
call git clone ssh://[email protected]/~/repo/site C:\git\project
if ($lastexitcode) {
Write-Host "Failed"
#error handling code here
}
else {
Write-Host "Completed"
}