Archive: Computer name to string


Computer name to string
Is there a way, using no windows enviornmental variables (cmd.exe) using NSIS alone to put the computer name into a string variable to further change a file name to the computer name

thank you


How about this?

NSIS Code Examples: Your Computer Name

nsis.sourceforge.net/Your_Computer_Name


If you don't need to Win 9x, you can also call the kernel32::GetComputerName() API with the System plug-in.
Examples of using GetUserName() on this forum are almost identical.

Stu


I'm not sure whether you were looking for a solution like the following:

Var ComputerName
Call GetComputerName

Function GetComputerName
ReadRegStr $0 HKLM "System\CurrentControlSet\Control\ComputerName\ActiveComputerName" "ComputerName"
StrCmp $0 "" win9x
StrCpy $1 $0 4 3
StrCpy $ComputerName $0
Goto done
win9x:
ReadRegStr $0 HKLM "System\CurrentControlSet\Control\ComputerName\ComputerName" "ComputerName"
StrCpy $1 $0 4 3
StrCpy $ComputerName $0
done:
FunctionEnd


Regards,
Swapan