congnt92 Posted March 21, 2016 Author Posted March 21, 2016 5 hours ago, Mcinwwl said: And again, I tried to do my best with Powershell. tested on PS 2.0/WinXP, both in PS console and Powershell ISE. Script outputs drive letter, free space, total space and label for each active removable drive (pendrives, portable HDDs, memory cards... and floppy discs :P) $drives = [System.IO.DriveInfo]::getdrives() | ?{$_.Drivetype -eq "Removable" -and $_.IsReady -eq $true} foreach ($d in $drives) {Write-host ("$($d.RootDirectory.name.TrimEnd("\"))" + " " + [math]::round(($d.AvailableFreeSpace)/1GB,2) + " " + [math]::round(($d.TotalSize)/1GB,2) + " " + "$($d.VolumeLabel)")} That was my output with 4 connected pendrives: G: 1.78 1.87 H: 14.87 29.28 I: 3.73 3.73 J: 7.16 7.31 KINGSTON Hope that was expected. Hi Mcinwwl, That's greate. And you're a Powershell professional, I guess you didn't really believe in yourself Just a question, how can I save it and use for batch file when i need a mix-method? Tks
gunsmokingman Posted March 21, 2016 Posted March 21, 2016 Here is the results with 2 usb drives plug in to my computer, remove the .txt to make active. UsbDrive.vbs.txt 1
congnt92 Posted March 22, 2016 Author Posted March 22, 2016 12 hours ago, gunsmokingman said: Here is the results with 2 usb drives plug in to my computer, remove the .txt to make active. UsbDrive.vbs.txt Hi, Gunsmokingman. I'm sorry. It work perfect. So problem come from copy-paste issue, not from your code. Thank you very much.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now