@echo off
rem ===========================================================
rem  rename_tool.bat
rem  Fighting Girl Voice Pack - Kanzaki Eris Astraea
rem
rem  Double-click this file. It runs rename_tool.ps1, which
rem  renames the voice files and folders to ID form, and
rem  restores the original names when run a second time.
rem
rem  Keep this file and rename_tool.ps1 together.
rem
rem  The display language follows your system settings.
rem  To force it:   rename_tool.bat ja     rename_tool.bat en
rem ===========================================================
setlocal
set "PS1=%~dp0rename_tool.ps1"

set "LANGARG="
if /i "%~1"=="ja" set "LANGARG=-Lang ja"
if /i "%~1"=="en" set "LANGARG=-Lang en"

if not exist "%PS1%" (
    echo.
    echo ERROR: rename_tool.ps1 not found.
    echo Keep this .bat and the .ps1 file in the same folder.
    echo.
    pause
    exit /b 1
)

where powershell.exe >nul 2>&1
if errorlevel 1 (
    echo.
    echo ERROR: Windows PowerShell was not found on this system.
    echo.
    pause
    exit /b 1
)

powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%PS1%" %LANGARG%
set "RC=%ERRORLEVEL%"

echo.
pause
exit /b %RC%
