SVN备份批次无法识别空格

时间:2013-08-09 13:24:05

标签: svn batch-file cmd

我正在尝试创建我的Google文档文件夹的SVN备份,并且空格中的所有文件夹都会被截断

for /f "tokens=2*" %%i in ('svn.exe status C:\Google ^| find "?"') do (svn.exe add "%%i")
svn.exe commit -m "automatic commit"

当我将其分解并运行时

svn.exe status C:\Google ^| find "?"

结果是

  ?       C:\Google\This Is A Test

所以我回应它,​​看看为什么批次没有提交所有内容

for /f "tokens=2*" %i in ('svn.exe status C:\Google ^| find "?"') do (echo %i)

,结果是

C:\Google\This

任何想法如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

更改为tokens=1,*并使用%%j

for /f "tokens=1,*" %%i in ('svn.exe status C:\Google ^| find "?"') do (svn.exe add "%%j")
svn.exe commit -m "automatic commit"

tokens=2*将第二个以空格分隔的值转换为%%i,剩余的%%j

如果您echo %%j,您会看到Is A Test