Welcome!

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

SignUp Now!

@BUSTYPE and @MEDIATYPE don't like my drive U:

Charles Dye

Super Moderator
May
5,387
166
Staff member
Code:
C:\>ver

TCC  33.00.9 x64   Windows 11 [Version 10.0.22621.4169]

C:\>echo %@bustype[c:]
8

C:\>echo %@mediatype[c:]
4

C:\>echo %@bustype[u:]
TCC: (Sys) The parameter is incorrect.
 "%@bustype[U:]"

C:\>echo %@mediatype[u:]
TCC: (Sys) The parameter is incorrect.
 "%@mediatype[U:]"

C:\>dir /w u:\

 Volume in drive U is USB DRIVE    Serial number is 8014:4450
 Directory of  U:\*

[BinUSB]                     [C64]                        [Install]                    [Xfer]                       bookmarks-2024-08-05.json
JBMASTER.D81                 Notepad++.msi                OfficeActivate.btm           R.msi                        RStudio.msi
SetupStata18.exe             ShowTag.msi                  spss-v28-license.txt         TaskBarPin.xml               WinAct.cmd
       1,077,048,136 bytes in 11 files and 4 dirs    1,077,542,912 bytes allocated
       5,122,818,048 bytes free

C:\>

Drive U: is a SanDisk flash drive, FAT32, plugged directly into the computer. Nothing special about it as far as I can see.
 
Those two variable functions are calling WMI to get the info, so either Windows or your redirector doesn't like your drive. How are you assigning it as "U:"?

With a driver called USBDLM — been using it for decades. I uninstalled and rebooted, but get the same error message.
 
When you rebooted, was your drive still "U:"?

@BUSTYPE makes two WMI calls, like this:

%@wmi[root\Microsoft\Windows\Storage, "select DiskNumber from MSFT_Partition where DriveLetter=%d"] -- where the %d arg is the upper case first letter of the argument to @BUSTYPE (for example, 67 for C:).

@BUSTYPE then takes the result returned from this call and passes it to WMI again:

%@wmi[root\Microsoft\Windows\Storage, "select MediaType from MSFT_PhysicalDisk where DeviceId=%d"] -- where the %d arg is the disk number returned by the first @wmi call.

If either of those calls fail, you'll see the "invalid parameter" error message.
 
Charles, do you have the WMI Code Creator app (old, from MS)? You can check all this stuff with it, including what Rex is doing above (which seems correct).
 
It's fun to use. I put it here. Be patient, it takes a while to load the namespaces.

1727375072675.webp


I have these. two SSDs (C and D) and a mounted external HDD (F) where I found the code creator.

Code:
-----------------------------------
MSFT_Partition instance
-----------------------------------
DiskNumber: 0
DriveLetter: 67
-----------------------------------
MSFT_Partition instance
-----------------------------------
DiskNumber: 1
DriveLetter: 68
-----------------------------------
MSFT_Partition instance
-----------------------------------
DiskNumber: 2
DriveLetter: 70
 
When you rebooted, was your drive still "U:"?

Yes, after rebooting without USBDLM, that flash drive still mounts at U:.

I tried with a different flash drive -- a cheapo -- and this one mounts at D:. @BUSTYPE and @MEDIATYPE are both happy with that one. If you don't want to pursue this further, that's fine with me.
 
Hey @vefatica,
Select your language (Batch),
Click Generate

Copy to clipboard

Paste into a .bat file
Code:
@ECHO OFF
:: WMI query to list selected or all properties and values of the \\root\Microsoft\Windows\Storage:MSFT_Partition class.
:: This batch file was generated using the WMI Code Generator, Version 10.0.15.6
:: https://www.robvanderwoude.com/wmigen.php

IF "%~1"=="" (
    SET Node=%ComputerName%
) ELSE (
    SET Node=%~1
)

FOR /F %%A IN ('WMIC.EXE /Node:"%Node%" /Namespace:\\root\Microsoft\Windows\Storage Path MSFT_Partition Get /Format:CSV ^| MORE.COM /E +2 ^| FIND.EXE /C ","') DO (
    IF %%A EQU 1 (
        ECHO 1 instance:
    ) ELSE (
        ECHO %%A instances:
    )
)

WMIC.EXE /Node:"%Node%" /Namespace:\\root\Microsoft\Windows\Storage Path MSFT_Partition Get DiskNumber^,DriveLetter /Format:Value

From TCC, run the .bat file.

On my system, it returned;
Code:
7 instances:




DiskNumber=0

DriveLetter=

            '\x0000'

        





DiskNumber=0

DriveLetter=

            '\x0000'

        





DiskNumber=0

DriveLetter=

            '\x0000'

        





DiskNumber=0

DriveLetter=

            'C'

        





DiskNumber=1

DriveLetter=

            '\x0000'

        





DiskNumber=1

DriveLetter=

            'E'

        





DiskNumber=2

DriveLetter=

            'F'

Joe
 
Back
Top