0

这就是我现在正在做的事情

@echo off
setlocal EnableDelayedExpansion
set /a FINALSVN=0

cd %~dp0 ..\..\..
set SKETCHDIR=%CD%
for /D %%D IN (%SKETCHDIR%\*) DO (
    FOR /F "tokens=*" %%L IN ('@svn info %%D ^| FIND "Last Changed Rev: "') DO (SET STR=%%L)
    SET STR=!STR:Last Changed Rev: =!
    SET /a INT=!STR!
    if !INT! GTR !FINALSVN! SET FINALSVN=!INT!
)

echo !FINALSVN!

endlocal
exit /b

我想要做的是摆脱 svn info 向我吐出的错误。我知道有错误,并不是所有的目录都能正常工作。这就是重点,如果它没有任何事情发生。我只是想让错误消失。我试过将 > NUL 和 ^>NUL 放在不同的地方,最后不知所措。有谁知道任何解决方案?

4

2 回答 2

1
@echo off
setlocal EnableDelayedExpansion
set /a FINALSVN=0

cd %~dp0 ..\..\..
set SKETCHDIR=%CD%
for /D %%D IN (%SKETCHDIR%\*) DO (
    FOR /F "tokens=*" %%L IN ('@svn info %%D ^| FIND "Last Changed Rev: " ^>nul 2^>^&1') DO (SET STR=%%L)
   if "!STR!" NEQ "" (
    SET STR=!STR:Last Changed Rev: =!
    SET /a INT=!STR!
    if !INT! GTR !FINALSVN! SET FINALSVN=!INT!
   )
)

echo !FINALSVN!

本地退出 /b

于 2013-11-08T22:22:04.197 回答
0
FOR /F "tokens=*" %%L IN ('svn info %%D 2^>nul ^| FIND "Last Changed Rev: "') DO (SET STR=%%L)
于 2013-11-09T01:44:29.123 回答