Content batch MyDisks.cmd file:
ExecShellWait 'open' '"$SYSDIR\cmd.exe"' '/c "D:\MyDisks.cmd"' SW_HIDE
Result MyDisks.ini :
@ECHO OFF
SETLOCAL EnableExtensions EnableDelayedExpansion
SET "InputFile=MyDisks.ini"
IF EXIST "%InputFile%" (DEL /f /q "%InputFile%")
FOR /F "skip=2 tokens=*" %%G IN ('
"WMIC PATH Win32_DiskDrive GET Caption,Index,Size /format:csv 2>NUL"
') DO (
@FOR /F "tokens=2,3,4 delims=," %%H IN ("%%G") DO (
SET "strCaption=%%H"
SET "strIndex=%%I"
SET "strSize=%%J"
>>"%InputFile%" CALL ECHO [Disk%%strIndex%%]
>>"%InputFile%" CALL ECHO Item=Index%%strIndex%% - %%strCaption%% (%%strSize%%^)
)
)
pause
But I do not know how to parse MyDisks.ini file for each item to the RichEdit control.
[Disk0]
Item=Index0 - Samsung EVO (232536803840)
[Disk1]
Item=Index1 - Adata USB Device (35718510080)
I tried
ReadINIStr $0 'D:\MyDisks.ini' 'DiskZZZ' 'Item'
but not success 🙁
I need content in the RichEdit control same as:
Please help me. 🙂
Index0 - Samsung EVO (232536803840)
Index1 - Adata USB Device (35718510080)
Thanks.