-
Notifications
You must be signed in to change notification settings - Fork 1
PowerShell Stuff
doronshai edited this page Jul 12, 2016
·
4 revisions
Remove Element from XML File using PowerShell
#Set file path
$File = 'C:\Jenkins\workspace\DS_Build_Component\ThisFile.xml'
#Get file contents as XML
[xml]$xml = Get-Content $File
#Remove the content of the 5th property Group
$Remove = $xml.Project.PropertyGroup[4].RemoveAll()
#Save file
$xml.Save($File)
How to handle CLI Arguments
Set Variables as Escaped String
$DeployFolderUNC = "\\$env:COMPUTERNAME\MC_Deployment\$env:JOB_NAME\$ENV:BUILD_ID"
$EscapedDeployFolderUNC = [string]::Format("{0}",$DeployFolderUNC.Replace('\','\\'))
$MCdeployFolderUNC = "MCdeployFolderUNC=$EscapedDeployFolderUNC"