Skip to content

Instantly share code, notes, and snippets.

@antiKk
Last active April 22, 2022 14:52
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antiKk/279966c27fdfd9c7fe63b4ae410f89c4 to your computer and use it in GitHub Desktop.
Save antiKk/279966c27fdfd9c7fe63b4ae410f89c4 to your computer and use it in GitHub Desktop.
$hactool = "$PSScriptRoot\hactool.exe"
$prodkeys = "$PSScriptRoot\prod.keys"
$firmware = "$PSScriptRoot\Firmware 10.1.0\"
$files = Get-ChildItem $firmware -Filter *.nca
$numfiles = 0
foreach ($file in $files) {
$hacout = & $hactool -k $prodkeys -i $firmware$file | Out-String
if($hacout -like '*Content Type: Meta*') {
Get-Item $firmware$file | Rename-Item -Path $firmware$file -NewName { $_.Name -replace '.nca','.cnmt.nca' }
$numfiles++
}
}
Write-Host "Renamed "$numfiles " ncas"
@deejay87
Copy link

perfect 13xforever :)

@Pysis868
Copy link

Pysis868 commented Apr 22, 2022

For deejay87's "Failed to match key" issue: SciresM/hactool#79.

Also my own little script:

iterateFiles -iname '*.nca' ! -iname '*.cnmt.nca' | while read file;
  if hactool -i "$file" | grep -iP '\bContent Type:\s+Meta\b';
    echo "$file";
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment