0
我們有一個xml文件,其中很少屬性存儲產品guid。如何使用select-string在xml文件中查找產品guid?
我想使用powershell select-string cmdlet找到guid,但它不返回任何值。
GEt-content rules.xml | Select-String "5351BABA-40C2-477B-8111-DA54A48CD8EB"
guid在文件中,我手動驗證。
爲什麼select-string無法找到產品導航?有沒有其他方法可以找到它是否可用?從XML
樣的內容文件
<Component Id="M_PostConfig" Name="Post-Configuration" StsDisplayEntry="Database Server Post-Configuration" StsDisplayText="Please wait while Post-Configuration is installed" UninstallCommand=""%pTxtFoldrSystem32%\msiexec.exe"" Version="2.30.1.3" UninstallParameters="/i {85bb61a2-e0d8-4c3b-83a7-d978dcd4b3d2} REMOVE=DBSERVER /L*V+ "%pFoldrInstallPath%\Foundation\Install\MSI_Uninstall.log" /qn msifeatwise" SupportUninstall="Yes"> </Component>
需要更多信息。我無法複製。 'Get-Content。\ Desktop \ test.xml |在包含您提供的示例的xml文件上,選擇字符串「85bb61a2-e0d8-4c3b-83a7-d978dcd4b3d2」'返回該行,因爲它應該。 – 2013-04-10 12:27:08
我會爲輸入文件使用完全限定的路徑,只是爲了確保腳本正在讀取與手動驗證時相同的文件。 – mjolinor 2013-04-10 13:24:20