Hello All,

I intend to develope a console application in C# in which there should be 3 functionalities :-

  1. Open Wordpad.exe and automatically type something.
  2. Save the updated document.
  3. Close the Wordpad with changes saved.

Kindly guide me if anyone has some ideas. I have managed to open Wordpad but rest I am not so sure. So please tell me the exact approach or the needful.

The Process Class, will do what you want, start the program, redirect the standard input then send text to the process. By sending the right key characters you should be able to save the file as well. The articles I linked to include sample code that should be able to guide you.

Personally I try to avoid API functions when there are .net functions that do the same thing. Less chance of the code breaking if the API changes.

Edited 3 Years Ago by tinstaafl

This question has already been answered. Start a new discussion instead.