user3222330
user3222330

Reputation: 1

get hard disk drive name in which windows OS installed using NSIS

I need to get hard disk drive letter like C: or D: or any in which the OS is installed on any windows.

Kindly help me get out of this.

Upvotes: 0

Views: 1180

Answers (1)

Anders
Anders

Reputation: 101569

Section
StrCpy $0 $sysdir 3
DetailPrint $0
SectionEnd

$SYSDIR is the Windows system directory (usually C:\Windows\System or C:\WinNT\System32, but that's detected at runtime).

StrCpy has the syntax StrCpy user_var(destination) str(source) [maxlen] [start_offset] where maxlen and start_offset are optional.

So the code above, copies the first three letters from $SYSDIR into the $0 variable.

Upvotes: 2

Related Questions