문제

나는 여러 볼륨을 가지고 있습니다 (요즘 거의 모든 사람과 마찬가지로) : Windows에서는 결국 C :, D : 등으로 지정됩니다. PowerShell과 함께 "ls /mnt /"가있는 Unix 컴퓨터 에이 모든 것을 어떻게 나열합니까?

도움이 되었습니까?

해결책

모든 파일 시스템 드라이브를 얻으려면 다음 명령을 사용할 수 있습니다.

gdr -PSProvider 'FileSystem'

gdr 별명입니다 Get-PSDrive, 여기에는 레지스트리의 모든 "가상 드라이브"등이 포함됩니다.

다른 팁

get-volume

얻을 수 있습니다 : Driveletter, FileSystemLabel, FileSystem, DriveType, Healthstatus, SizerEmaining 및 Size

Windows PowerShell :

Get-PSDrive 
[System.IO.DriveInfo]::getdrives()
wmic diskdrive
wmic volume

또한 유틸리티 dskwipe : http://smithii.com/dskwipe

dskwipe.exe -l

먼저, 유닉스에서 당신은 사용합니다 mount, 아니다 ls /mnt: 많은 것들이 장착되지 않았습니다 /mnt.

어쨌든, mountvol PowerShell에서 계속 작동하는 DOS Command, PowerShell 별이 있습니다. Get-PSDrive.

이것은 꽤 오래되었지만 주목할만한 가치가 있습니다.

PS N:\> (measure-command {Get-WmiObject -Class Win32_LogicalDisk|select -property deviceid|%{$_.deviceid}|out-host}).totalmilliseconds
...
928.7403
PS N:\> (measure-command {gdr -psprovider 'filesystem'|%{$_.name}|out-host}).totalmilliseconds
...
169.474

필터링 속성이 없으면 테스트 시스템에서 4319.4196ms ~ 1777.7237ms. PS-Drive 객체가 필요하지 않으면 WMI를 고수하겠습니다.

편집 : 우승자가 있다고 생각합니다 : ps n :> (geasure-command {[system.io.driveinfo] :: getDrives () |%{$ _. name} | out-Host}). to talmilliseconds 110.9819

이것은 'PowerShell'특정은 아니지만 ... DiskPart, List Volume을 사용하여 드라이브 및 파티션을 쉽게 나열 할 수 있습니다.

PS C:\Dev> diskpart

Microsoft DiskPart version 6.1.7601
Copyright (C) 1999-2008 Microsoft Corporation.
On computer: Box

DISKPART> list volume

Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
----------  ---  -----------  -----  ----------  -------  ---------  --------
Volume 0     D                       DVD-ROM         0 B  No Media
Volume 1         C = System   NTFS   Partition    100 MB  Healthy    System
Volume 2     G   C = Box      NTFS   Partition    244 GB  Healthy    Boot
Volume 3     H   D = Data     NTFS   Partition    687 GB  Healthy
Volume 4     E   System Rese  NTFS   Partition    100 MB  Healthy

드라이브 당 여러 볼륨이 있습니다 (일부는 드라이브의 하위 디렉토리에 장착됩니다). 이 코드는 마운트 포인트 및 볼륨 레이블 목록을 보여줍니다. 분명히 여유 공간 등을 추출 할 수도 있습니다.

gwmi win32_volume|where-object {$_.filesystem -match "ntfs"}|sort {$_.name} |foreach-object {
  echo "$(echo $_.name) [$(echo $_.label)]"
}

실행 명령 :

Get-PsDrive -PsProvider FileSystem

자세한 내용은 다음을 참조하십시오.

alt text

PS 기능 :> get-psdrive

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top