Param( [Parameter(Mandatory, HelpMessage="List of PRI files or XML dumps (detailed only) to merge")] [string[]] $Path, [Parameter(Mandatory, HelpMessage="Output Path")] [string] $OutputPath, [Parameter(HelpMessage="Name of index in output file; defaults to 'Application'")] [string] $IndexName = "Application", [Parameter(HelpMessage="Path to makepri.exe")] [ValidateScript({Test-Path $_ -Type Leaf})] [string] $MakePriPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\MakePri.exe" ) $ErrorActionPreference = 'Stop' $tempDir = Join-Path ([System.IO.Path]::GetTempPath()) "tmp$([Convert]::ToString((Get-Random 65535),16).PadLeft(4,'0')).tmp" New-Item -ItemType Directory -Path $tempDir | Out-Null $priConfig = Join-Path $tempDir "priconfig.xml" $priListFile = Join-Path $tempDir "pri.resfiles" $dumpListFile = Join-Path $tempDir "dump.resfiles" @" "@ | Out-File -Encoding:utf8NoBOM $priConfig $Path | Where { $_ -Like "*.pri" } | ForEach-Object { Get-Item $_ | Select -Expand FullName } | Out-File -Encoding:utf8NoBOM $priListFile $Path | Where { $_ -Like "*.xml" } | ForEach-Object { Get-Item $_ | Select -Expand FullName } | Out-File -Encoding:utf8NoBOM $dumpListFile & $MakePriPath new /pr $tempDir /cf $priConfig /o /in $IndexName /of $OutputPath Remove-Item -Recurse -Force $tempDir