I want to excute commands like dir, ping, ipconfig... etc. and I want to get the result in my VB code as a string.

One way to do it as I know is to do write into a file.bat my command: "dir > out_file.txt", do a shell("file.bat"), and then read the file out_file.txt... but it's too "dirty", and I also want to multi-thread my app, in that case I have to make a new filename everytime, and also make sure that the file is deleted afterwards.... way too much work, for something that sould be more simple...

I want to make a telnet server; the server does the command then sends the data to the client...

I think the Pipe API's do that but how ?
Anyone has some sample code to do it ?

Thanks