Created
December 30, 2011 07:15
-
-
Save SamRH/1538432 to your computer and use it in GitHub Desktop.
A script to find and copy required DLLs of an executable to the current directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DLLBINDIR='/usr/i686-pc-mingw32/sys-root/mingw/bin/' | |
function usage | |
{ | |
echo "Usage: `basename $0` file.exe" | |
echo \ | |
"copies required dynamically linked libraries to \ | |
the current directory" | |
} | |
if [ $# -ne 1 ] | |
then | |
usage | |
exit 1 | |
fi | |
if [ ! -f "$1" ] | |
then | |
usage | |
fi | |
EXE=$1 | |
DLLS=$(i686-pc-mingw32-objdump -p $EXE | grep 'DLL Name: ' | sed 's/\tDLL Name: //') | |
for i in $DLLS | |
do | |
if [ -f ${DLLBINDIR}${i} ] | |
then | |
cp -f "${DLLBINDIR}${i}" . | |
echo "Copied $i to current directory" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment