Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find out a files “mime-type(Content-Type?)”? on Windows

Is there a way to find out the MIME-TYPE (or is it called "Content-Type"...) of a file in windows batch/PowerShell?

like image 450
eldblz Avatar asked Sep 08 '15 14:09

eldblz


People also ask

How do I find the MIME type of a file?

For detecting MIME-types, use the aptly named "mimetype" command. It has a number of options for formatting the output, it even has an option for backward compatibility to "file". But most of all, it accepts input not only as file, but also via stdin/pipe, so you can avoid temporary files when processing streams.

How do I find Content-Type?

Ctrl + Shift + I.

How do I change the MIME type of a file in Windows?

In the Connections pane, go to the site, application, or directory for which you want to add a MIME type. In the Home pane, double-click MIME Types. In the MIME Types pane, click Add... in the Actions pane. In the Add MIME Type dialog box, add the file name extension and MIME type, and then click OK.


1 Answers

While not directly in the Windows command prompt, a more modern approach is to use Git for Windows. Once installed, run git-bash and the command file path\to\file. An example output might be:

TestFile.ico: MS Windows icon resource - 1 icon, 128x128, 32 bits/pixel

Alternatively, use the command file -i path\to\file which might give:

TestFile.ico: image/vnd.microsoft.icon; charset=binary
like image 145
AlainD Avatar answered Sep 28 '22 08:09

AlainD