Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Done add %@drivemediatype and %@drivebustype variable functions

Sep
84
2
In Powershell you can do the command
Get-PhysicalDisk | select Friendlyname, BusType, MediaType

To see the bustype and mediatype for disks, but there isn't an easy way to then connect this to a specific drive. It would be nice to know if drives returned from %@drivetypeex of type 3 were HDD, SSD, and if SSD if they were NVME. Some things happen so fast on NVME drives that they become CPU limitted so it would be nice to be able to check for this.
 
@mdlawler if you are referring to dtype.btm,
the source code for dtype.btm is here.

Joe
Here is a modified version to give the bus type

@echo off
setlocal
if %# == 0 (echo Usage: DTYPE.BTM drive_letter[...] & quit)
:: DriveLetter is the ASCII code of an uppercase letter; e.g., the c drive is 67
set letter=%@ascii[%@upper[%@instr[0,1,%1]]]
set DiskNumber=%@wmi[root\Microsoft\Windows\Storage,"select DiskNumber from MSFT_Partition where DriveLetter=%letter"]
if "%DiskNumber" == "" ( echoerr No such disk & quit )
set MediaType=%@wmi[root\Microsoft\Windows\Storage,"select MediaType from MSFT_PhysicalDisk where DeviceId=%DiskNumber"]
if "MediaType" == "" (echoerr Unknown error & quit)
set BusType=%@wmi[root\Microsoft\Windows\Storage,"select BusType from MSFT_PhysicalDisk where DeviceId=%DiskNumber"]
if "BusType" == "" (echoerr Unknown error & quit)
switch %MediaType
case 0
echos UNSPECIFIED ``
case 3
echos HHD ``
case 4
echos SSD ``
case 5
echos SCM ``
default
echos UNKNOWN ``
endswitch
switch %BusType
case 0
echo UNSPECIFIED
case 1
echo SCSI
case 2
echo ATAPI
case 3
echo ATA
case 4
echo IEEE 1394
case 5
echo SSA
case 6
echo Fibre Channel
case 7
echo USB
case 8
echo RAID
case 9
echo iSCSI
case 10
echo Serial Attached SCSI (SAS)
case 11
echo Serial ATA (SATA)
case 12
echo Secure Digital (SD)
case 13
echo Multimedia Card (MMC)
case 17
echo NVME
default
echo UNKNOWN
endswitch
endlocal
 
Code:
@echo off
setlocal
    if %# == 0 (echo Usage: DTYPE.BTM drive_letter[...] & quit)
    :: DriveLetter is the ASCII code of an uppercase letter; e.g., the c drive is 67
    set letter=%@ascii[%@upper[%@instr[0,1,%1]]]
    set DiskNumber=%@wmi[root\Microsoft\Windows\Storage,"select DiskNumber from MSFT_Partition where DriveLetter=%letter"]
    if "%DiskNumber" == "" ( echoerr No such disk & quit )
    set MediaType=%@wmi[root\Microsoft\Windows\Storage,"select MediaType from MSFT_PhysicalDisk where DeviceId=%DiskNumber"]
    if "MediaType" == "" (echoerr Unknown error & quit)
    set BusType=%@wmi[root\Microsoft\Windows\Storage,"select BusType from MSFT_PhysicalDisk where DeviceId=%DiskNumber"]
    if "BusType" == "" (echoerr Unknown error & quit)
    switch %MediaType
        case 0
            echos UNSPECIFIED ``
        case 3
          echos HHD ``
        case 4
          echos SSD ``
        case 5
        echos SCM ``
            default
        echos UNKNOWN ``
    endswitch
  switch %BusType
        case 0
          echo UNSPECIFIED
        case 1
            echo SCSI
        case 2
            echo ATAPI
        case 3
          echo ATA
        case 4
          echo IEEE 1394
        case 5
          echo SSA
        case 6
            echo Fibre Channel
        case 7
            echo USB
        case 8
            echo RAID
        case 9
            echo iSCSI
        case 10
            echo Serial Attached SCSI (SAS)
        case 11
            echo Serial ATA (SATA)
        case 12
          echo Secure Digital (SD)
        case 13
            echo Multimedia Card (MMC)
        case 17
            echo NVME
        default
            echo UNKNOWN
    endswitch
endlocal
 
V33 added the following;
Code:
Whats New in Version 33                                                             
@BUSTYPE[drive:] - returns the bus type for the specified drive. The possible return values are:

0 - unspecified
1 - SCSI
2 - ATAPI
3 - ATA
4 - IEEE 1394
5 - SSA
6 - Fibre Channel
7 - USB
8 - RAID
9 - iSCSI
10 - SAS
11 - SATA
12 - SD
13 - MMC
17 - NVME

Anything else returns an empty result

@MEDIATYPE[drive:] - returns the media type for the specified drive. The possible return values are:

0 - Unspecified
3 - HHD
4 - SSD
5 - SCM
Anything else returns an empty result

Joe
 
Back
Top
[FOX] Ultimate Translator
Translate