Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 2nd July 2019, 13:44   #1
meoit
Member
 
Join Date: Oct 2014
Location: $DESKTOP
Posts: 90
Post Parse cmd.exe output in ini file for each item to RichEdit

I run batch file with command:

code:

ExecShellWait 'open' '"$SYSDIR\cmd.exe"' '/c "D:\MyDisks.cmd"' SW_HIDE



Content batch MyDisks.cmd file:

code:

@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



Result MyDisks.ini :

code:

[Disk0]
Item=Index0 - Samsung EVO (232536803840)
[Disk1]
Item=Index1 - Adata USB Device (35718510080)



But I do not know how to parse MyDisks.ini file for each item to the RichEdit control.

I tried

ReadINIStr $0 'D:\MyDisks.ini' 'DiskZZZ' 'Item'

but not success

I need content in the RichEdit control same as:

code:

Index0 - Samsung EVO (232536803840)
Index1 - Adata USB Device (35718510080)



Please help me.

Thanks.
meoit is offline   Reply With Quote
 
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump