Is it possible for PowerShell to determine what a given file’s type is? For example, if I pass it a path of C:\Foo.zip, can I have it determine that the file at that path is, in fact, a zip file and not something else?
Is it possible for PowerShell to determine what a given file’s type is? For
Share
PowerShell, like rest of the Windows operating system, merely guesses the file type based on the extension.
However, there are third-party file type guesser programs out there, ones that actually look at the contents of the file.
There is a truly excellent answer to this question over on SuperUser. Top recommendations include File for Windows and TrID.