i try write something to get the hdd index in a batch script, the command below in comand prompt works well
wmic diskdrive where "model like '%st%' and size > 300000000000" get index,model
it returns
Index Model
1 ST1000DM010-2EP102
but when i use it inside batch script, it return 'no instances available':
@echo off
for /f "usebackq skip=1" %%a in (`wmic diskdrive where "model like '%st%' and size > 300000000000" get index`) do echo %%a
pause
result of script
No Instance(s) Available.
by the way, if there is a better way to get the hdd index in batch script.
wmic diskdrive where "model like '%st%' and size > 300000000000" get /format:csv
@Compo, The result of the command is showed as follows
Node,Availability,BytesPerSector,Capabilities,CapabilityDescriptions,Caption,CompressionMethod,ConfigManagerErrorCode,ConfigManagerUserConfig,CreationClassName,DefaultBlockSize,Description,DeviceID,ErrorCleared,ErrorDescription,ErrorMethodology,FirmwareRevision,Index,InstallDate,InterfaceType,LastErrorCode,Manufacturer,MaxBlockSize,MaxMediaSize,MediaLoaded,MediaType,MinBlockSize,Model,Name,NeedsCleaning,NumberOfMediaSupported,Partitions,PNPDeviceID,PowerManagementCapabilities,PowerManagementSupported,SCSIBus,SCSILogicalUnit,SCSIPort,SCSITargetId,SectorsPerTrack,SerialNumber,Signature,Size,Status,StatusInfo,SystemCreationClassName,SystemName,TotalCylinders,TotalHeads,TotalSectors,TotalTracks,TracksPerCylinder
W0400966,,512,{3;4},{Random Access;Supports Writing},ST1000DM010-2EP102,,0,FALSE,Win32_DiskDrive,,Disk drive,\\.\PHYSICALDRIVE1,,,,CC46,1,,IDE,,(Standard disk drives),,,TRUE,Fixed hard disk media,,ST1000DM010-2EP102,\\.\PHYSICALDRIVE1,,,3,SCSI\DISK&VEN_ST1000DM&PROD_010-2EP102\4&BFDEFCD&0&000100,,,0,0,0,1,63, ZN1PYMST,3140447416,1000202273280,OK,,Win32_ComputerSystem,W0400966,121601,255,1953520065,31008255,255