我无法打印更改列表。每次我运行我的脚本并检查值时,它都是空白的。
postcommithook.bat
set REPOS=%1
set REV=%2
set TXN_NAME=%3
set LF = ^
SET ThisScriptsDirectory=%~dp0
set svnlook = "C:\Program Files\TortoiseSVN\bin\"
for /f "tokens=*" %%a in ('%svnlook% svnlook author -r %REV% %REPOS%') do set AUTH_NAME=%%a
setlocal enabledelayedexpansion
set MSG = for /f %%i in ('svnlook changed -r %REV% %REPOS%') do (
SET "VAR=!VAR!!LF%%i"
SET "PAR=!PAR!^^!LF!!LF!%%i"
)
set DIRS_CHANGED = !VAR!
endlocal
SET PowerShellScriptPath=%ThisScriptsDirectory%emailer.ps1
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& '%PowerShellScriptPath%' '%REPOS%' '%REV%' '%TXN_NAME%' '%AUTH_NAME%' '%DIRS_CHANGED%'";
我知道我在循环中的某个地方犯了一个错误,我在调用change函数。如何获取已更改目录的列表并将其传递给邮件程序脚本?
提前致谢
答案 0 :(得分:0)
在这里回答我自己的问题: 我已经删除了命令'svn changed'完成的循环。相反,我将输出存储在一个单独的文件中,然后通过powershell / vbscript文件开始处理它,以生成电子邮件。
取代以下内容:
svnlook changed %REPOS% -r %REV% > %ThisScriptsDirectory%tmp_log.txt
而不是
setlocal enabledelayedexpansion
set MSG = for /f %%i in ('svnlook changed -r %REV% %REPOS%') do (
SET "VAR=!VAR!!LF%%i"
SET "PAR=!PAR!^^!LF!!LF!%%i"
)
set DIRS_CHANGED = !VAR!
endlocal
谢谢, Venkat。