Powershell read XML format config file

upload.xml
<?xml version="1.0" ?> <ftpConfig> <Protocol>ftp</Protocol> <HostName>127.0.0.1</HostName> <UserName>admin</UserName> <Password>Password</Password> <RemotePath>/e/test/path/data/</RemotePath> <LocalPath>e:\test\path\data\</LocalPath> </ftpConfig>

$xmlData=[xml](Get-Content "E:\test\path\scripts\upload.xml")
$localPath = $xmlData.ftpConfig.LocalPath
$remotePath = $xmlData.ftpConfig.RemotePath


posted @ 2018-01-19 16:48  h.yl  阅读(151)  评论(0)    收藏  举报