sam
sam

Reputation: 4694

How to concatenate resolved path with another directory

How to concatenate web config resources directory path with resolved main directory path. In Octopus resolve-path gets me correct path of directory but I wont be able to concatenate that path with another directory. I am using following code, please guide.

$webConfigResources = (resolve-path .)
$webConfigResources +=  "\ResourcesConfiguration.config"
$doc = (gc $webConfigResources) -as [xml]
$doc.SelectSingleNode('//resourcesConfigSection/resources/@baseDirectory').'#text' =            
$doc.Save($webConfigResources)

Upvotes: 1

Views: 417

Answers (1)

David Brabant
David Brabant

Reputation: 43589

Resolve-Path returns a System.Management.Automation.PathInfo object (not a string). Use Join-Path:

$webConfigResources = Join-Path (Resolve-Path .) "\ResourcesConfiguration.config"

Upvotes: 4

Related Questions