none
Batch Script get SSD model name and match type RRS feed

  • Question

  • Hi,

    I am trying write below batch script to get installed SSD model name and match to LITEON.

    C:\Users\Userone>wmic diskdrive get model
    Model
    LITEON CV3-CE256 SCSI Disk Device

    Now I have to read first 6 character of "LITEON CV3-CE256 SCSI Disk Device" model name and match to "LITEON" using batch script (.cmd).

    Could you please help me on this.

    Thanks in Advance.

    Thanks

    Ramesh

    Thursday, September 7, 2017 8:14 PM

Answers

  • Hi All,

    Thanks for your reply.

    Finally I wrote below Script to achieve my requirement!  Please check below it may be useful for you as well.

    @Echo off
    SET _startchar=0
    SET _length=4
    set "xprvar="
    for /F "skip=1 delims=" %%i in ('wmic diskdrive get model') do if not defined xprvar set "xprvar=%%i"
    echo Detected SSD Model - %xprvar%
    CALL Set var=%%xprvar:~%_startchar%,%_length%%%
    IF /I "%var%" == "NVMe" ( 
    Msg * "Detected SSD type is NVMe" 
    PAUSE
    )

    Thanks

    Ramesh

    • Marked as answer by Er Reddy Thursday, September 7, 2017 10:07 PM
    Thursday, September 7, 2017 10:07 PM

All replies