QuickBMS "wrong command-line argument"

Doubts, help and support about QuickBMS and other game research tools
jonaskohl
Posts: 1
Joined: Mon Aug 13, 2018 6:15 pm

QuickBMS "wrong command-line argument"

Post by jonaskohl »

Hi there!

I use the following batch file to mass extract game files:

Code: Select all

@echo off

rem Set directories. Can be changed.
set bfbb_gameroot="<REMOVED FOR FORUM POST>"
set bfbb_export="<REMOVED FOR FORUM POST>"

rem --- Script start ---

rem Prompt user for map directory and map file name
set /p bfbb_mapdir="Enter map directory (e.g. bb):"
set /p bfbb_mapid="Enter map id (e.g. BB01):"

set bfbb_extract="%bfbb_export%\%bfbb_mapdir%"

rem Create output directory
md "%bfbb_extract%"

rem Extract files
quickbms "%cd%\SpongeBobBBBPS2hop.bms" "%bfbb_gameroot%\%bfbb_mapdir%\%bfbb_mapid%.HOP" "%bfbb_extract%"

rem Copy and rename texture files
md "%bfbb_extract%\tex"
copy "%bfbb_extract%\*.RWTX" "%bfbb_extract%\tex\*.txd"

echo Done! Press any key to exit
pause>nul
exit /b


But I get this output from QuickBMS:

Code: Select all

QuickBMS generic files extractor and reimporter 0.9.0
by Luigi Auriemma
e-mail: me@aluigi.org
web:    aluigi.org
        (Jun 17 2018 - 11:49:55)

                   quickbms.aluigi.org  Homepage
                            zenhax.com  ZenHAX Forum
                     @zenhax @quickbms  Twitter & Scripts


Error: wrong command-line argument (<REMOVED FOR FORUM POST>\SpongeBobBBBPS2hop.bms)


What am I doing wrong?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: QuickBMS "wrong command-line argument"

Post by aluigi »

Spaces in the bfbb_* directories that enable the usage of the quote.
Replace quickbms with echo and you will get what I mean, the double quote:
"c:\\SpongeBobBBBPS2hop.bms" ""c:\xxx xxx"\bb\bb01.HOP" """c:\xxx 2"\bb""

This stuff is ever a pain, take a look here:
https://ss64.com/nt/syntax-args.html
https://ss64.com/nt/syntax-esc.html

you can also use the -v option after quickbms for debugging the interpretation of the command-line without echo, long story short it's rare but in some particular occasions there is a difference in how the arguments are handled by C/C++ programs and, for example, .NET. It's not this case but it's just something interesting to know :D