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: estpathdata</LocalPath> </ftpConfig>

$xmlData=[xml](Get-Content "E:	estpathscriptsupload.xml")
$localPath = $xmlData.ftpConfig.LocalPath
$remotePath = $xmlData.ftpConfig.RemotePath


原文地址:https://www.cnblogs.com/dufu/p/8317779.html