Skip to content
⌘ NSIS Forum Archive

NSIS how to get USB/HDD/PortableHDD name and save to text

8 posts

meoit#

NSIS how to get USB/HDD/PortableHDD name and save to text

Hi guys.

I am try to get USB/HDD/PortableHDD/PortableSSD/ExternalDisks name and save to the .txt file.

I am using WMI header on NSIS-wiki

But not successful.

Someone help me.

Thanks.
meoit#
https://nsis.sourceforge.io/WMI_header

${WMIGetInfo} ROOT\CIMV2 Win32_DiskDrive Model Win32_DiskDrive_Model

Function Win32_DiskDrive_Model
DetailPrint '$R0/$R1 = $R2'
;StrCpy $Var_Disks '$R2$\n'
FunctionEnd

It is show disks, but I do not know how to save to .txt.
r2du-soft#
Originally Posted by meoit View Post
https://nsis.sourceforge.io/WMI_header

${WMIGetInfo} ROOT\CIMV2 Win32_DiskDrive Model Win32_DiskDrive_Model

Function Win32_DiskDrive_Model
DetailPrint '$R0/$R1 = $R2'
;StrCpy $Var_Disks '$R2$\n'
FunctionEnd

It is show disks, but I do not know how to save to .txt.


!include WMI.NSH

Var Memo

Section

${WMIGetInfo} ROOT\CIMV2 Win32_DiskDrive Model Win32_DiskDrive_Model

SectionEnd

Function Win32_DiskDrive_Model

FileOpen $Memo "$EXEDIR\DiskDrives.txt" a
FileSeek $Memo 0 END
FileWrite $Memo '$R0/$R1 = $R2'
FileClose $Memo

FunctionEnd
Anders#
Originally Posted by meoit View Post
Thanks r2du-soft.

Content display on 1 line.
How to show per line for object.
Add $\r$\n. You should be able to research these basic issues on your own...