Archive: Simple quesiton, how to get exec output?


Simple quesiton, how to get exec output?
I'm having a hard time getting the output from the C:\Windows\System32\hostname.exe command. I just want to grab the hostname. I've tried Nsexec, Exec, ExecDos and I can't get the output properly. If I log it to a file I get a strange ASCII characters at the end which I would need to parse.

I've looked at the FAQ, did a search, looked at various scripts and I don't see it...

Can someone give me a quick example? It would come much appreciated.

Thanks!


you can call GetHostName with the system plugin


Yeeee...you mean call the System.dll file...didn't think about that (new to Windows)...is this different than reading out of "HKLM System\Services\Tcpip\Parameters Hostname"? That's what I'm doing as a work around.


System::Alloc 400
pop $2
System::Call 'ws2_32::WSAStartup(i 514, i r2) i .r3'
System::Call 'ws2_32::gethostname(t .r0, i ${NSIS_MAX_STRLEN}) i .r1'
System::Call 'ws2_32::WSACleanup() i .r4'
System::Free $2
MessageBox MB_OK "WSA startup result $3, WSA cleanup result $4, gethostname result $1, hostname $0"

from http://forums.winamp.com/showthread.php?threadid=144919


Thanks man...talk about overhead!