Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file svnlook cat-t在windows上不工作(当我创建.bat脚本时)_Batch File_Transactions_Cat_Pre Commit_Svnlook - Fatal编程技术网

Batch file svnlook cat-t在windows上不工作(当我创建.bat脚本时)

Batch file svnlook cat-t在windows上不工作(当我创建.bat脚本时),batch-file,transactions,cat,pre-commit,svnlook,Batch File,Transactions,Cat,Pre Commit,Svnlook,我正在尝试编写一个.bat脚本作为svn中的预提交挂钩。但是,当我尝试使用带有-t选项的svnlook cat命令时,它不起作用。它一直告诉我语法错误。我尝试了一切,包括添加引号、更改-t选项等。但是,如果我删除-t选项,它不会报告语法错误。 这就是错误脚本: SET REPOS=%~1 (I want to remove the quotes of the path) SET TXN=%2 "C:\Program Files (x86)\VisualSVN Server\bin\svnlo

我正在尝试编写一个.bat脚本作为svn中的预提交挂钩。但是,当我尝试使用带有-t选项的svnlook cat命令时,它不起作用。它一直告诉我语法错误。我尝试了一切,包括添加引号、更改-t选项等。但是,如果我删除-t选项,它不会报告语法错误。 这就是错误脚本:

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
如果我这样做,他们都很好:

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

谁来帮帮我!!谢谢

别管大家了,我想我是自己想出来的。我们应该使用SET TXN=%~2来消除引号。即使我这样做了,愚蠢的批处理也会在变量TXN的末尾添加一个空格。这就是问题的原因。因此,脚本应该如下所示:

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

您可以回答自己的问题并将其标记为已接受,而不只是将答案编辑到问题中。通过这种方式,您可以获得分数,并且问题不会在SO数据库中保持“未回答”。。。。
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