Ray K.
Ray K.

Reputation: 2511

Passing parameters to SVN in a PowerShell script

I am trying to automate a procedure that uses SVN, and I am trying to teach myself PowerShell (and scripting) in the process.

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: "

It then calls SVN and (tries to) pass the parameters.

Here's my problem: When I try to call SVN as follows:

& "c:\Program Files\TortoiseSVN\bin\svn.exe" "-log -r $RevStart`:$RevEnd  $GetSVN"

I get the following message:

svn: E205000: Non-numeric limit argument given
svn: E200004: Could not convert 'og -r BASE:#### [SVN file path]' into a number

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?

I am a newbie to PowerShell scripting, so feel free to answer as such.

Thanks in advance . . .

Upvotes: 2

Views: 1888

Answers (1)

majkinetor
majkinetor

Reputation: 9046

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.

Upvotes: 4

Related Questions