1

I want to check whether all my dlls and libs within a project were built for x64 using

dumpbin /headers *.obj | findstr machine

which outputs a list of e.g. 8664 machine (x64). How can I print the filename for each listed file? Or do I have to extract filenames into a separate textfile before to go with a for loop?

Peter Ruderman
  • 12,241
  • 1
  • 36
  • 58
alex555
  • 1,676
  • 4
  • 27
  • 45

2 Answers2

2

dumpbin /headers *.obj | findstr "machine Dump" will print the "Dump of file ...." line and the machine type line.

From the findstr help

Use spaces to separate multiple search strings unless the argument is prefixed with /C. For example, 'FINDSTR "hello there" x.y' searches for "hello" or "there" in file x.y. 'FINDSTR /C:"hello there" x.y' searches for "hello there" in file x.y.

jcopenha
  • 3,935
  • 1
  • 17
  • 15
  • Thanks, but that is not exactly what I wanted. – alex555 Jan 17 '13 at 15:25
  • 1
    no problem. Next time if you make your question more explicit about what you are looking for, such as how do I print "filename: machine", you'll get better answers. – jcopenha Jan 17 '13 at 19:00
  • @jcopenha - looking at the edit history, the only thing that changed on the question were the tags. Perhaps I'm mis-reading his request, bit it seems to me he was clear enough in his question when he asked how to print the file being operated upon. – jww May 03 '14 at 03:53
  • @jww His request is for filenames and machine types. The output of my command generates that. In his comment he clarifies saying he wants "filename: machine". Which is a refinement of the format of the output. If you run the accepted answer and my answer you get all of the same information. the only difference is final format which wasn't specified in the original question. – jcopenha May 04 '14 at 21:55
2

After a long look I found the solution for my problem

FOR /F %i IN ('DIR /B 2^>nul *.obj') DO (
    echo | set /P=%i:
    dumpbin /headers %i | findstr machine
)
alex555
  • 1,676
  • 4
  • 27
  • 45