Win2K Telnet Server with Indy

I'm trying to write a "command prompt" telnet server like the one
included with Win2K Server using the Indy telnet server component. I
tried something like the following (in pseudo code):

procedure TMyForm.MyTelnetServerExecute(AThread: TIdPeerThread);
begin
  sCommand := AThread.Connection.InputLn('');
  WinExec('command.com ' + sCommand + ' > TMPFILE'), SW_HIDE);
  sOutput := // Read all lines in TMPFILE //
  AThread.Connection.WriteLn(sOutput);
end;

The problem with this approach is when issuing a change directory  (cd
otherdirectory). For the next command that is issued, the directory
goes back to the default directory since it's a new WinExec call to
COMMAND.COM. I need a way to persist the current directory through all
WinExec calls.

I hope I made myself clear enough.. Does anyone have a solution to
this?