Perl: Get minimum supported operating system for a binary
-
20-02-2021 - |
题
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
解决方案
If you need this for Windows, use get_manifest from Win32::Exe. You will need to install it first.
其他提示
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.