Created
March 31, 2022 04:00
-
-
Save 128keaton/a8a9b83d210560d60c852b58e4ed8bec to your computer and use it in GitHub Desktop.
Powershell scripts used to help manage a collection of Wii games
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$currentISOs = Get-ChildItem -Path .\iso -Name -Include *.iso | |
$currentRZVs = Get-ChildItem -Path .\rvz -Name -Include *.rvz | |
$dolphinToolPath = "..\Dolphin-x64\DolphinTool.exe" | |
$totalConverted = 0 | |
foreach ($rvz in $currentRZVs) | |
{ | |
$iso = $rvz -replace '.rvz', '.iso' | |
if ($currentISOs -eq $null -or !$currentISOs.Contains($iso)) { | |
Write-Host "Converting " -NoNewline | |
Write-Host $rvz -NoNewline -ForegroundColor Red | |
Write-Host " to " -NoNewline | |
Write-Host $iso -ForegroundColor Cyan | |
$output = "$(Get-Location)\iso\$iso" | |
$input = "$(Get-Location)\rvz\$rvz" | |
Start-Process -FilePath $dolphinToolPath -ArgumentList "convert -i `"$input`" -o `"$output`" -f iso" -RedirectStandardError iso-err.txt -WindowStyle hidden -Wait | |
Write-Host "Converted $iso!" -ForegroundColor Green | |
$totalConverted++ | |
} | |
} | |
Write-Host "$totalConverted converted" -BackgroundColor Green -ForegroundColor Black |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$currentISOs = Get-ChildItem -Path .\iso -Name -Include *.iso | |
$currentWBFSs = Get-ChildItem -Path .\wbfs -Name -Include *.wbfs | |
$wbfsToolPath = ".\wbfs_file.exe" | |
$totalConverted = 0 | |
$saveSpace = True | |
foreach ($iso in $currentISOs) | |
{ | |
$wbfs = $iso -replace '.iso', '.wbfs' | |
if ($currentWBFSs -eq $null -or !$currentWBFSs.Contains($wbfs)) { | |
Write-Host "Converting " -NoNewline | |
Write-Host $iso -NoNewline -ForegroundColor Red | |
Write-Host " to " -NoNewline | |
Write-Host $wbfs -ForegroundColor Cyan | |
$output = "$(Get-Location)\wbfs\$wbfs" | |
$input = "$(Get-Location)\iso\$iso" | |
Start-Process -FilePath $wbfsToolPath -ArgumentList "`"$input`" convert `"$output`"" -RedirectStandardError wbfs-err.txt -WindowStyle hidden -Wait | |
Write-Host "Converted $wbfs!" -ForegroundColor Green | |
if ($saveSpace) { | |
Remove-Item "$input" | |
$emptyISO = New-Object System.IO.FileStream $input, Create, ReadWrite | |
$emptyISO.SetLength(1KB) | |
$emptyISO.Close() | |
} | |
$totalConverted++ | |
} | |
} | |
Write-Host "$totalConverted converted" -BackgroundColor Green -ForegroundColor Black |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment