Reputation: 109
I am interfacing Powershell to Subversion, and I am having an issue, where Powershell is not completeling my url for Subversion, due to a space being in the path.
$Source = C:\Users\'+env:USERNAME+'\Desktop\FileDownloadLocation'
$SVNPath = 'http://subversion/svn/MainDirectory/SecondaryDirectory/Directory with a Space/subdirectory/finalLocation'
TortoiseProc.exe /command:checkout /url:$SVNPath /path:$Source /closeend:2
What shows up in the Subversion Checkout Window is:
'http://subversion/svn/MainDirectory/SecondaryDirectory/Directory '
I need to pass the remaining portion of the URL to Subversion. Is there a way for me to do this in Powershell, and how would I have to go about including whitespaces into my URL Paths for Subversion, in Powershell?
Upvotes: 0
Views: 1060
Reputation: 1
enclosing the path in triple quotes worked for me:
$path="""path to folder/file with spaces"""
TortoiseProc.exe /command:update /path:$path /closeend:1
Upvotes: 0
Reputation: 13
I know this post is a bit old, but perhaps this will help someone else. The underlying issue can come up with many command line arguments, not just with TortoiseProc.exe.
For some reason the %20 idea was not working for me so here is an alternative solution. The issue here is that TortoiseProc.exe (among many others) requires that a path with spaces in it be surrounded by quotes. But by default PowerShell does not pass the actual quote characters, only what is inside them.
The solution: include escaped quotes inside the "normal" quotes. So it would look like this:
TortoiseProc.exe /command:checkout /url:"`"$SVNPath`"" /path:"`"$Source`"" /closeend:2
Pay close attention to the backtick characters that are "escaping" the inner quotes. This causes those quote characters to be passed literally as part of the string and now TortoiseProc.exe will properly handle file paths and URLs with spaces.
Upvotes: 1
Reputation: 7638
You should be able to just enclose the variable in quotes as well.
TortoiseProc.exe /command:checkout /url:"$SVNPath" /path:"$Source" /closeend:2
Upvotes: 0