2

我正在尝试从“调用 ppm 查询断言”捕获 stoutput,如果它等于“ * no packages installed matching 'assert' ** ”或更好但包含字符串“no packages”做“something”..正在安装包裹。任何建议都会很棒..我一直在为此挠头。提前致谢。

: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
)
4

1 回答 1

3
call ppm query assert | findstr /c:"no packages" >nul && (
  echo package not found
) || (
  echo package found
)
于 2012-05-17T18:29:48.900 回答