获得window下的所有盘符

获得window下的所有盘符:
File[] files = File.listRoots();
		for(File f : files){
			System.out.println(f.getPath());
		}

//验证是否为Window操作系统
			if(System.getProperties().getProperty("os.name").contains("Window"))
			{
				currentParentDir="C:"+System.getProperties().getProperty("file.separator");//默认根目录为C盘
				isWindowOS=true;
			}else{
				currentParentDir=System.getProperties().getProperty("file.separator");//获得当前操作系统的文件分隔符
			}

你可能感兴趣的:(window)