Old 24th May 2019, 01:05   #1
meoit
Member
 
Join Date: Oct 2014
Location: $DESKTOP
Posts: 88
Post 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 is offline   Reply With Quote
Old 24th May 2019, 09:35   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,098
Which name? Volume/partition label name? Name of the hardware?

Post the code you have tried.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 24th May 2019, 10:47   #3
meoit
Member
 
Join Date: Oct 2014
Location: $DESKTOP
Posts: 88
@Anders All USB/Fixed Disks Name, not label/volume/partition name.
meoit is offline   Reply With Quote
Old 24th May 2019, 14:10   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,098
Play around with the WMIC tool to find out where this information is stored.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 24th May 2019, 14:31   #5
meoit
Member
 
Join Date: Oct 2014
Location: $DESKTOP
Posts: 88
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.
meoit is offline   Reply With Quote
Old 24th May 2019, 17:37   #6
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 334
Quote:
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.


HTML Code:
!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
r2du-soft is offline   Reply With Quote
Old 25th May 2019, 00:29   #7
meoit
Member
 
Join Date: Oct 2014
Location: $DESKTOP
Posts: 88
Thanks r2du-soft.

Content display on 1 line.
How to show per line for object.
meoit is offline   Reply With Quote
Old 25th May 2019, 00:40   #8
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,098
Quote:
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...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
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