Question

I'm trying to write a .bat script as the pre-commit hooks in svn. However when I was trying to use the svnlook cat command with the -t option, it's not working. It kept telling me syntax errors. I tried everything including adding quotes, changing the -t option etc. However, if I remove the -t option, it doesn't report syntax errors. So this is the error scripts:

SET REPOS=%~1 (I want to remove the quotes of the path)
SET TXN=%2 

"C:\Program Files (x86)\VisualSVN Server\bin\svnlook.exe" cat -t %TXN% %REPOS% myworkingdir/txtIwanttoread

If I do the following, they are all fine:

SET REPOS=%~1 (I want to remove the quotes of the path)
SET TXN=%2 

"C:\Program Files (x86)\VisualSVN Server\bin\svnlook.exe" cat %REPOS% myworkingdir/txtIwanttoread

OR

SET REPOS=%~1 (I want to remove the quotes of the path)
SET TXN=%2 

"C:\Program Files (x86)\VisualSVN Server\bin\svnlook.exe" cat -r 28 %REPOS% myworkingdir/txtIwanttoread

Somebody please help me!! Thanks!

Never mind everybody, I think I just figured it out myself. We should use SET TXN=%~2 to eliminate the quotes. Also even if I did that, the stupid batch puts a space at the end of the variable TXN. This is what causes the problem. So the script should look like:

SET REPOS=%~1 (I want to remove the quotes of the path)
SET TXN=%~2 
SET TXN=%TXN: =% (deblank)

"C:\Program Files (x86)\VisualSVN Server\bin\svnlook.exe" cat -t %TXN% %REPOS% myworkingdir/txtIwanttoread

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top