如何用PowerShell脚本编辑VisualElementsManifest.xml ?



我看过很多关于如何用PowerShell编辑XML文件的帖子,但是,我不能得到任何解决方案在我的情况下工作(我只有一点使用PowerShell和脚本的经验)。

我想编辑位于C:ProgramDataTileIconifyWindows Store中的Windows Store.VisualElementsManifest.xml,以改变它:

<?xml version="1.0" encoding="utf-8"?>
<Application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" GeneratedByTileIconifier="true">
<VisualElements ShowNameOnSquare150x150Logo="on" Square150x150Logo="VisualElementsMediumIconWindows Store.png" Square70x70Logo="VisualElementsSmallIconWindows Store.png" ForegroundText="dark" BackgroundColor="#41413D" TileIconifierColorSelection="Default" TileIconifierCreatedWithUpgrade="true" />
</Application>

:

<?xml version="1.0" encoding="utf-8"?>
<Application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" GeneratedByTileIconifier="true">
<VisualElements ShowNameOnSquare150x150Logo="on" Square150x150Logo="VisualElementsMediumIconWindows Store Dark.png" Square70x70Logo="VisualElementsSmallIconWindows Store Dark.png" ForegroundText="dark" BackgroundColor="#41413D" TileIconifierColorSelection="Default" TileIconifierCreatedWithUpgrade="true" />
</Application>

我感到困惑,因为在VisualManifest.xml文件中的字符串充满了引号和空格,这打破了PowerShell脚本,我读过的线程都没有解释如何处理。

似乎你正在寻找更新你的XML,Square150x150LogoSquare70x70Logo的2个属性,如果是这样的话,你可以试试这个:

$filePath = 'PathtoWindows Store.VisualElementsManifest.xml'
$xml = [xml]::new()
$xml.Load($filePath)
$visualElements = $xml.Application.VisualElements
$visualElements.Square150x150Logo = "VisualElementsMediumIconWindows Store Dark.png"
$visualElements.Square70x70Logo   = "VisualElementsSmallIconWindows Store Dark.png"
$xml.Save($filePath)

相关内容

  • 没有找到相关文章

最新更新