Easily. Just use the I/O classes (ByteArrayInputStream) to read the data. I think the real question here is "does anyone know the .EXE file format".
I'd suggest a bit of "Googling" to find the file format; heres one I found without looking too hard http://www.delorie.com/djgpp/doc/exe/ and then using that info to know which bytes to use to create the info you need.
> Well yes, but that gives me the same result if I go
> to notepad and drag the EXE there... I get mixed code
> that says nothing :\
Kind of. Except you have know idea what bits to get. With the file format, you need to know where the bits of data you need are structured. Usually, the file will contain some header which gives offsets to other structural 'chunks' of data, one of which will be of interest to you. Read this in and find the offset, move to that offset and read in the 'chunk'. This will contain the data you want. Read in the bytes from the chunk which represent the info you want and pass those bytes into a String. This will then be the version or filename or whatever 'chunk' you have read.
The really hard bit is working out the file format and where your info lies in it. Once you know that, reading the stuff is a breeze.
I'm sure there are Windows API functions to do this, rather than reinventing the wheel. I'm sure you don't need to read the file in the raw - you're going down the wrong path.
I'm not going to do the research for you though on what the API function(s) are, however I am just giving you a hint that I'm positive they exist. It would be the same API that the properties window uses.
To use that API you'd have to write a C / C++ / other more native language piece of code, which if desired you could wrap in JNI and access it from Java.
I can't find a thing about that. :(
Perhaps I'll tell you what I need that for:
I got tired of rearranging my start menu and drag-n-droppin' every time I install a new program, so I wanted to create an application that scans a folder of my choice (i.e. c:/progra~1) and creates a folder in the start menu with shortcuts to all of the EXEs in the folder and in its subfolders, arranged by application name (some applications have more than one EXE, including uninstall or update programs) and usage (that I'll do at the end, basing on rules and lists I'll create from DOWNLOAD.COM, for instance). I've done everything but the usage types filtering (putting it into folders: "system", "media", "internet", etc).
So my problem was, that the shortcuts' names are ugly most of the times, and I can't tell the full name of an application just from its filename. For example, Google Earth's main EXE is "googleearth.exe". A shortcut that says "Googleearth" isn't so nice to look at. also, with this kind of name you can know what it does, but what about other filenames that don't exactly say what that file does?
I needed a way to get the -true- name of the application file, and the only way I see is through the properties, in the "Description" field under "Version".
But alas, that's not so simple :P
I thought about simply getting the name from the folder the EXE's in, but then there are more than one EXE per folder.
Any other suggestions will be great.
Thanks again, guys.