Skip to content

Instantly share code, notes, and snippets.

@bitsydoge
Created November 7, 2023 23:35
Show Gist options
  • Save bitsydoge/8ec105ebd81bb0cfcf4b98486c854e82 to your computer and use it in GitHub Desktop.
Save bitsydoge/8ec105ebd81bb0cfcf4b98486c854e82 to your computer and use it in GitHub Desktop.
use BLPConverter.exe from https://github.com/PatrickCyr/BLPConverter
param (
[string]$folderPath,
[string]$destinationPath = $folderPath,
[string]$BLPConverter = "BLPConverter.exe"
)
# Check if folderPath is provided
if ([string]::IsNullOrEmpty($folderPath)) {
Write-Error "Error: folderPath must be provided."
Write-Host "Usage: script.ps1 -folderPath <FolderPath> [-destinationPath <DestinationPath>] [-BLPConverter <ConverterPath>]"
exit 1
}
# Check if BLPConverter exists
if (-not (Test-Path -Path $BLPConverter)) {
Write-Error "Error: BLPConverter not found at the specified path: $BLPConverter"
exit 1
}
$blpFiles = Get-ChildItem -Path $folderPath -Filter *.blp
foreach ($blpFile in $blpFiles) {
$blpFilePath = $blpFile.FullName
$destinationFileName = [System.IO.Path]::ChangeExtension($blpFile.Name, "png")
$destinationFilePath = Join-Path -Path $destinationPath -ChildPath $destinationFileName
& $BLPConverter $blpFilePath $destinationFilePath
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment