Perl: Get minimum supported operating system for a binary

148 views Asked by At

Is there a Perl command that lets me get the minimum supported OS for any given binary?

You can manually get that information by running "link /dump /headers [binaryFile]" and looking for the "subsystem version" link. I don't want to use that since it's got really bad perf.

Thanks

2

There are 2 answers

1
Alexandr Ciornii On BEST ANSWER

If you need this for Windows, use get_manifest from Win32::Exe. You will need to install it first.

1
jwd On

If there's a command that gets what you want, why not just run that command?

You can use backticks or qx// in Perl to get a command's output

eg:

my $output = `command arg1 arg2 ...`;

Or, if you want an array of lines:

my @lines = `command arg1 arg2 ...`;

Then you can use Perl's normal facilities for scanning that output for patterns you're interested in.

Also, your command looks like it is for Windows - is that true? If so, you should add a Windows tag.