2
There are several ways to do this, one of them is to use the function FindWindow to return the window identifier through the class or title name.
To close, you can use the function SendMessage and use the sign WM_CLOSE to indicate that the application should be finalised.
Take an example:
procedure TForm1.Button2Click(Sender: TObject);
var
  Janela: THandle;
begin
  Janela := FindWindow(nil, 'teste'); // "teste" é o título da janela
  if Janela > 0 then // Se conseguir encontrar a janela
     SendMessage(Janela, WM_CLOSE, 0, 0);
end;

when you say folder, refers to Windows folder?
– durtto
yes windows folder, this is her directory: "C: test"
– Tmc