PowerShell: Possible to Determine a File's MIME Type?

后端 未结 4 1139
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-05 04:15

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

4条回答
  •  醉梦人生
    2021-01-05 04:43

    $ext = ".exe"
    $null = New-PSDrive HKCR Registry HKEY_CLASSES_ROOT -ea 0
    $mime = (gp HKCR:$ext)."Content Type"
    write-host $ext $mime
    

提交回复
热议问题