问题描述
我正在尝试自动化使用 SVN 的过程,并且我正在尝试在此过程中自学 PowerShell(和脚本).
I am trying to automate a procedure that uses SVN, and I am trying to teach myself PowerShell (and scripting) in the process.
我设置了一个 PowerShell 脚本来读取修订号和我的文件夹路径的值,如下所示:
I set up a PowerShell script that reads values for revision numbers and my folder path, like this:
$GetSVN = read-host "Enter the SVN folder path: "
$RevStart = read-host "Enter the starting revision: "
$RevEnd = read-host "Enter the ending revision: "
然后调用 SVN 并(尝试)传递参数.
It then calls SVN and (tries to) pass the parameters.
这是我的问题:当我尝试按如下方式调用 SVN 时:
Here's my problem: When I try to call SVN as follows:
& "c:\Program Files\TortoiseSVN\bin\svn.exe" "-log -r $RevStart`:$RevEnd $GetSVN"
我收到以下消息:
svn: E205000: Non-numeric limit argument given
svn: E200004: Could not convert 'og -r BASE:#### [SVN file path]' into a number
好的,好的.我尝试在-log"之前添加一个额外的空格.但是当我这样做时,会发生以下情况:
Okay, fine. I tried adding an extra space before "-log". But when I do that, here's what happens:
Unknown subcommand: ' -log -r BASE:#### [SVN file path]'
嗯?!?这是怎么回事?我已经尝试了这个的各种变体,但都无济于事.我在任何地方都找不到答案.有没有人有任何见解?
Huh?!? What's going on with this? I've tried various variations of this, all to no avail. I can't find an answer to this anywhere. Does anyone have any insight?
我是 PowerShell 脚本的新手,所以请随意回答.
I am a newbie to PowerShell scripting, so feel free to answer as such.
提前致谢...
推荐答案
你的调用有误,多个参数归为一个.更好和正确的方法是这样的:
Your call is wrong, multiple parameters are grouped as one. Better and correct way to do it is this:
set-alias svn "c:\Program Files\TortoiseSVN\bin\svn.exe"
svn log -r $RevStart`:$RevEnd $GetSVN
设置别名是化妆品.真正的问题是 "
放置.
Setting alias is cosmetics. The real problem were "
placement.
这篇关于在 PowerShell 脚本中将参数传递给 SVN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!