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 ) $ErrorActionPreference = 'Stop' If (-not $MakePriPath) { $winSdk10Root = $(Get-ItemPropertyValue -Path "HKLM:\Software\Microsoft\Windows Kits\Installed Roots" -Name "KitsRoot10") $MakePriPath = "$winSdk10Root\bin\10.0.26100.0\x64\MakePri.exe" } If ($null -Eq (Get-Item $MakePriPath -EA:SilentlyContinue)) { Write-Error "Could not find MakePriPath.exe at `"$MakePriPath`".`nMake sure that -MakePriPath points to a valid SDK." Exit 1 } $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