How can I extract all .obj files from a .lib file? The only way I found is to extract one at once. Is there a way to automate it?
LIB.EXE /EXTRACT:member.obj Library.LIB
This is the batch file that I ended up using with usage extract.bat mylib.lib
or extract.bat *.lib
even
@ECHO OFF
SETLOCAL EnableDelayedExpansion
:Loop
IF "%1"=="" GOTO Continue
FOR %%F in (%1) DO (
SET LIBFILE=%%F
SHIFT
@ECHO !LIBFILE!
FOR /F %%O IN ('lib.exe /LIST !LIBFILE! /NOLOGO') DO (
@SET OBJFILE=%%O
@ECHO !OBJFILE!
SET OBJPATH=%%~dO%%~pO
SET OBJNAME=%%~nO
IF NOT EXIST "!OBJPATH!" md !OBJPATH!
IF EXIST "!OBJFILE!" ECHO !OBJFILE! exists, skipping...
IF NOT EXIST "!OBJFILE!" lib.exe /NOLOGO !LIBFILE! "/EXTRACT:!OBJFILE!" "/OUT:!OBJFILE!"
)
)
GOTO Loop
:Continue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With