@echo off
if exist "%~dp0firefox.exe" (echo.) && if exist "%~dp0xul.dll" (
echo ҵҪעļfirefox.exexul.dll. 
goto platform
) else (
echo ûҵļ,ѳİװĿ¼ִ.
goto eof
)

if  not exist %~dp0firefox.exe (
echo ûҵļ,ѳİװĿ¼ִ.
goto eof
)

:platform
@echo ѡע32λ64λfirefox.
@set /p fx=[32λ밴1,   64λ밴2]
if "%fx%"=="1" set arch=X86.exe&goto x86
if "%fx%"=="2" set arch=X64.exe&goto x64
@echo ȷ֣&ping -n 1 127.0.0.1>nul&goto platform

:x86
@echo ѡע32λfirefox
injectpe_%arch% firefox.exe portable32.dll
injectpe_%arch% xul.dll portable32.dll
goto err

:x64
@echo ѡע64λfirefox
injectpe_%arch% firefox.exe portable64.dll
injectpe_%arch% xul.dll portable64.dll

:err
if "%errorlevel%"=="0" echo עɹ,ϸĶreadme.txtportable(example).iniļ!
if "%errorlevel%"=="-1" echo עʧ!

:eof
pause .
@del /s/q injectpe_x*.exe 2>nul 1>nul
if "%fx%"=="1" del /s/q portable64.dll
if "%fx%"=="2" del /s/q portable32.dll
if not exist %~dp0portable.ini copy /y %~dp0portable(example).ini %~dp0portable.ini 2>nul 1>nul
@del /s/q %0
