Calling ipconfig

Hi, trying to develop a mini server, which is working fine if I manually specify the ipv4 ip address returned from running ipconfig from command prompt, but I was hoping to be able to call ipconfig from within the application itself to set the ip address automatically. Is there anyway of doing this in exeoutput for php ? I have tried exec(‘ipconfig’) but doesn’t appear to work. I see that you can call executable from hescript, but I don’t see anyway of obtaining the output - back in php to process.

Hope someone can help - so close to finishing this server.

Many Thanks.

No worries, seen this thread System() do not work - exec() and system() don’t work… was wondering therefore if there are any direct ways of accessing the ipv4 address of a pc/laptop - alas cannot use localhost for server as need the application to be accessed from within windows XP mode (virtualization) - where localhost is of the XP machine not of the parent machine. I guess for now will just have to manually enter the ip address.

You also have a way to call and wait for external EXE files. It’s a replacement for missing exec().

It’s described in the documentation at:

http://www.exeoutput.com/help/samplescriptrunexe

Cheers for that, but is there anyway of storing in a string the output of the program been run. Need to try to get the output of ipconfig, so i can scan it to obtain the ip address line(s).

Thanks.

I have developed the following hescript (as passing the argument in a terminal box works fine), but it just isn’t working, and I have no idea why…

procedure MacroExecuteIPconfig;
var
EbookPath, MyProgram: String;
begin
CbookPath := “C:\Windows\System32”;
EbookPath := GetGlobalVar(“HEPublicationPath”, “”);
MyProgram := CbookPath + “ipconfig.exe”;
RunAProgram(MyProgram, “>” + EbookPath + “ipconfig.log”, CbookPath, false, SW_SHOWNORMAL);
MessageBox(ReplaceString(MyProgram + " >" + EbookPath + “ipconfig.log”, “%20”, " "), GetString(“SPubTitle”), MB_OK+MB_ICONINFORMATION);
end;

I am assuming hescript (unlike php) doesn’t need double \ to work correctly - the idea is to run ipconfig program and send the results to a file called ipconfig.log, but no such file is been made. Also assuming that the output redirection that works in terminal is treated as an argument in the RunAProgram call ?

messagebox is displaying the correct output.

Thanks for any help.

Solved it with the following… now produces an ipconfig.log file I can use…

procedure MacroExecuteIPconfig;
var
EbookPath, CbookPath, MyProgram: String;
begin
CbookPath := “C:\Windows\System32”;
EbookPath := GetGlobalVar(“HEPublicationPath”, “”);
MyProgram := CbookPath + “cmd.exe”;
RunAProgram(MyProgram, "/C ipconfig > "+EbookPath+“ipconfig.log”, CbookPath, false, SW_SHOWNORMAL);
end;

Basically calls command prompt via cmd.exe using /C argument so it runs the command line then exits… then runs ipconfig redirecting output to the correct output folder in a file called ipconfig.log… which the rest of my php script can read it to obtain the ipv4 address for local server.

Thank you for the script!