2012-05-17 69 views
2

我試圖捕獲來自「調用ppm查詢斷言」的stoutput,如果它等於「*沒有安裝匹配包」斷言「**」或更好,但包含字符串「no軟件包「做」某事「正在安裝軟件包。任何建議將是偉大的..我一直在這個撓頭。提前致謝。從cmd批處理腳本捕獲輸出

:datetime 
echo Installing datetime package 
call ppm query assert 
IF "%OUT%" == "*** no packages installed matching 'assert' ***" (
    echo testtest 
::ppm install datetime 
pause 
) ELSE (
GOTO :win32::api 
) 

回答

3
call ppm query assert | findstr /c:"no packages" >nul && (
    echo package not found 
) || (
    echo package found 
)