views:

267

answers:

1

I need get the SVN commit message in post-commit hook bat in Windows, so I do this:

FOR /F "tokens=*" %%a in ('"svnlook log %1 -r %2"') do @SET MSG=%%a

I test it, it's ok for most case.

but, when I input multiple lines in SVN commit message, the command can only get the last line of commit message, I think it's caused by the windows batch file limit.

How to get the entire commit message to bat variable?

A: 

FOR /F operates over the lines in the input. Try Changing @SET MSG=%%a to @SET MSG=!MSG! %%a.

Patrick Cuff
don't forget `setlocal enabledelayedexpansion`, then.
Joey
Thanks, setlocal enabledelayedexpansion is the key~
zhongshu