Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- :: Localise environment.
- setlocal enableextensions enabledelayedexpansion
- ::Make a variable for backspace cause $h is being a dickwad
- for /f %%a in ('"prompt $H&for %%b in (1) do rem"') do set "BS=%%a"
- :: delete all files in the directory that have the name "tmp_" in the front of them
- del "tmp_*.*" 2>nul
- ::make the temporary batch file that extracts the assets while the main window waits have
- ::the commands needed to extract and delete the flag file
- echo >>"tmp_asset_extractor.cmd" "win32\asset_unpacker.exe" "contents.pak" "Unpacked Contents"
- echo >>"tmp_asset_extractor.cmd" del "tmp_asset_extractor.flg"
- ::start the child batch file and start monitoring for the flag file's deletion
- call :monitor "tmp_asset_extractor.cmd" "tmp_asset_extractor.flg" 900
- goto :final
- :monitor
- :: Create flag file and start the extractor.
- echo >>%2 dummy file ignore this.
- start /min cmd.exe /c "%1"
- :: Start monitoring for completion
- set i=0
- set m=%3
- <nul (set /p z=Waiting assets to finish extracting: ^|)
- :: Loop here awaiting completion.
- :loop
- :: Wait one second.
- ping 127.0.0.1 -n 2 >nul
- :: Update counters and output progress indicator.
- set /a "i = i + 1"
- set /a "m = m - 1"
- if %i% equ 4 set i=0
- if %i% equ 0 <nul (set /p z=%BS%^|)
- if %i% equ 1 <nul (set /p z=%BS%/)
- if %i% equ 2 <nul (set /p z=%BS%-)
- if %i% equ 3 <nul (set /p z=%BS%\)
- :: End conditions, complete or timeout.
- if not exist %2 (
- echo.
- echo. Files Successfully extracted!
- del "tmp_*.*" 2>nul
- pause
- goto :final
- )
- if %m% leq 0 (
- echo.
- echo. *** ERROR: Timed-out waiting for extraction to finish.
- pause
- goto :final
- )
- goto :loop
- :final
- endlocal
Advertisement
Add Comment
Please, Sign In to add comment