有没有办法找出MIME类型(或者叫做"Content-Type"...)windows batch/PowerShell中的文件?
发布于 2015-09-08 22:57:35
使用File from source或者您可以使用get win32 binaries from here
来自空文件的示例:
COPY NUL >test.ext && "C:\Program Files (x86)\GnuWin32\bin\file" −-mime-type test.ext它将返回以下内容:
test.ext; text/plain更新:
此外,-b或--brief不会在输出行中添加文件名
file -b −-mime-type test.ext仅返回mime类型:text/plain
键入file --help可查看更多选项
注意:源代码比GnuWin32提供给我们的可执行文件要新得多。
发布于 2020-07-20 04:27:41
虽然不是直接在Windows命令提示符中使用,但更现代的方法是使用Git for Windows。安装完成后,运行git-bash和命令file path\to\file。示例输出可能是:
TestFile.ico: MS Windows icon resource - 1 icon, 128x128, 32 bits/pixel或者,使用命令file -i path\to\file,该命令可能会提供:
TestFile.ico: image/vnd.microsoft.icon; charset=binaryhttps://stackoverflow.com/questions/32460177
复制相似问题