【问题标题】:How can I find out the file system being used in Windows? Preferably in code如何找出 Windows 中使用的文件系统?最好在代码中
【发布时间】:2009-02-07 02:59:45
【问题描述】:

如何找出 Windows 中使用的文件系统类型?最好在代码中。

【问题讨论】:

  • 你是说代码吗?如果有,是什么语言?如果不是,那不是编程问题。
  • 哪个白痴认为这个问题令人反感?同样,为什么它被否决了?阅读常见问题解答。 @Cletus,如何对 Graeme Perrow 这样的问题进行建设性的编辑。在代码中找出文件系统的类型显然很有用。

标签: windows filesystems


【解决方案1】:
function string get_FileSystem( strPath )
  object objFSO, objDrive;
begin
  set objFSO = CreateObject ( "Scripting.FileSystemObject" );
  if ( IsObject (objFSO) ) then
    try
      set objDrive = objFSO.GetDrive( objFSO.GetDriveName( strPath ) );
      if ( IsObject( objDrive ) ) then
        //Available return types include FAT, NTFS, FAT, FAT32, and CDFS
        return objDrive.FileSystem;
      endif;
    catch
      MessageBox( "Unable to determine File System.", INFORMATION );
    endcatch;
  endif;
end;

来自http://kb.acresso.com/selfservice/viewContent.do?externalID=Q107782

【讨论】:

    【解决方案2】:
    Console.WriteLine(new DriveInfo(Environment.SystemDirectory).DriveFormat);
    

    C#

    【讨论】:

      【解决方案3】:

      在资源管理器中右键单击驱动器,选择属性。文件系统应该在那里显示。

      【讨论】:

        【解决方案4】:

        只需使用 Win32 api : Win32 FAQ since 1992 !

        (见新闻://comp.os.ms-windows.programmer.win32)

        【讨论】:

        • 不要相信这个答案。该新闻组没有常见问题解答。
        【解决方案5】:

        这里有一些可以帮助你的代码

        foreach (DriveInfo objDrive in DriveInfo.GetDrives())
        {
                Response.Write("</br>Drive Type : " + objDrive.Name);
                Response.Write("</br>Drive Type : " + objDrive.DriveType.ToString());
                Response.Write("</br>Available Free Space : " + objDrive.AvailableFreeSpace.ToString() + "(bytes)");
                Response.Write("</br>Drive Format : " + objDrive.DriveFormat);
                Response.Write("</br>Total Free Space : " + objDrive.TotalFreeSpace.ToString() + "(bytes)");
                Response.Write("</br>Total Size : " + objDrive.TotalSize.ToString() + "(bytes)");
                Response.Write("</br>Volume Label : " + objDrive.VolumeLabel);
                Response.Write("</br></br>");
        
        }
        

        【讨论】:

          【解决方案6】:

          如果您指的是 Win32 而不是 .NET,请参阅 WinAPI GetVolumeInformation() 函数。你可以在http://msdn.microsoft.com找到它的文档

          【讨论】:

            猜你喜欢
            • 2023-04-05
            • 1970-01-01
            • 2012-11-24
            • 1970-01-01
            • 1970-01-01
            • 2017-05-07
            • 1970-01-01
            • 2011-04-18
            • 1970-01-01
            相关资源
            最近更新 更多