At here Get command prompt out on one line, with support from https://stackoverflow.com/users/2152082/stephan I can get output on one line, but now I have problem about Checking substring in String for each output line in command prompt.
I want to output as this:
HDD0 Samsung EVO 12345678 bytes
USB1 Apacer Sticky 77777777777 bytes
HDD2 Western 33442134566 bytes
for /f "skip=2 tokens=2 delims=," %%a in (' "wmic path Win32_DiskDrive get MediaType /format:csv" ') do (
echo %%a
REM I need check if it containing string Removable
if "%%a"=="Removable" (
echo is-USB!.
for /f "skip=2 tokens=2,3,4 delims=," %%a in ('"wmic path Win32_DiskDrive get DeviceID,Model,Size /format:csv"') do (
REM I need repacle "\\.\PHYSICALDRIVE" to "" in %%a
echo USB%%a %%b - %%c >> "Disk.txt"
)
) else (
echo is-HDD!.
for /f "skip=2 tokens=2,3,4 delims=," %%a in ('"wmic path Win32_DiskDrive get DeviceID,Model,Size /format:csv"') do (
REM I need repacle "\\.\PHYSICALDRIVE" to "" in %%a
echo HDD%%a %%b - %%c >> "Disk.txt"
)
)
)
The output is empty. Please help me. Thanks.