To modify the script and avoid setting "SSDMODEL" as empty, you can use an if statement to check if the value is empty before setting it. Here's the modified script:

@echo off
for /F "skip=1 tokens=*" %%a in ('"wmic diskdrive where index=0 get model,serialnumber"') do (
    if not "%%a"=="" set "SSDMODEL=%%a"
)

echo SSD Model: %SSDMODEL%

This modified script checks if the value of "%%a" is not empty before setting the "SSDMODEL" variable. If the value is not empty, it will be assigned to "SSDMODEL". Otherwise, the variable will not be set. The echo command is used to display the value of "SSDMODEL" for testing purposes.

FCrystalDiskInfofor F skip=1 tokens= a in wmic diskdrive where index=0 get modelserialnumber do set SSDMODEL=a rystalDiskInfoset SSDMODEL=Hoodisk SSD KBTMC9A21213962 rystalDiskInfoset SSDMODEL

原文地址: https://www.cveoy.top/t/topic/i63v 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录