2011-12-08 7 views

答えて

1

代わりにこれを試してみてください:

setlocal enabledelayedexpansion 
set found_deploy=0 
for /f 'eol=; tokens=1 delims=' %%c in ('"c:\program files\visualsvnserver\bin\svnlook.exe" log -r2 d:\repositories\myrepo ^| findstr "~~DEPLOY~~"') do (
    set found_deploy=1 
) 

if "!found_deploy!"=="1" (
    @REM::do_something_based_on_finding_deploy 
) else (
    @REM::do_something_based_on_not_finding_deploy 
) 
2

使用& &と||条件付き

"c:\program files\visualsvn server\bin\svnlook.exe" log -r2 d:\repositories\myrepo | findstr "~~DEPLOY~~" >nul && (
    #do_Something_If_Success 
) || (
    #do_Something_Else_If_Failure 
) 
1

前のコマンドの成功または失敗に基づいてコマンドを実行するためにdbenhamの答えは、先進的かつcripticの両方であるIF-THEN-ELSEを組み立てます。 kikuchiyoのものは不必要に複雑です。

これは前の二つの間の媒質の点である:

"c:\program files\visualsvn server\bin\svnlook.exe" log -r2 d:\repositories\myrepo | findstr "~~DEPLOY~~" >nul 
if errorlevel 1 (
    echo Deploy not found 
) else (
    echo Deploy found 
) 
関連する問題