Hey

I would like to do a ".bat' type of command in C#: Something automated. Im trying to run a program that is sort of shell itself so it just need to input certain words/letters into the command line box. Lets see if I can explain it better with a theoretical example:


[start of cmd]
C:\>echo hello
hello

C:\>someshell
[start of someshell: It has a command deleteall that deletes everything. It has a command bye that exits someshell]
> deleteall
Are you sure you want to delete all? [Y/N] Y
Everything has been deleted!
> bye
[end of someshell]
C:\>exit
[end of cmd]


As you can see the things I would have to type in the prompt if in cmd are:

echo hello
someshell
deleteall
Y
bye
exit

The biggest problem is the "Y" I believe, since cmd invokes someshell which at the same time and during invokes deleteall.

How could I do this in C#? Thanks.

Nothing like this exists for C#?

1) Are you trying to interact with an existing shell?
2) Are you trying to create a shell?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.