Writing a "Command Prompt"

  • Thread starter Thread starter Mrinal
  • Start date Start date
M

Mrinal

Hi Tobin ,

Well i am not very sure , how much will this help you out :

1. You want to create a better Command Prompt , may be with some extra
facilities / customiztion , then :

a. Why do you want to call standard cmd.exe via process class ? - since in
that case you will be getting nothing more than standard command
prompt .

b. When you start a process using Process class , it will essentially be a
separate process , you won't be able to communicate without creating a proxy
..

I think if you want to create a Better command prompt , you can look out for
some API's , that you can access to acheive the task or some class to
inherit from to just override the standard methods and getting the work done
..

i will see if i can get some relevant information and will pass it on .

thanks ,

Mrinal
 
Hi there folks,

I want to write a c# application that mimicks the Windows command prompt.
Basically, I want to write a better command prompt! I've started playing
with ideas, but can't get the darn thing off the ground. Is it possible with
..NET?

My simple starting point is a multiline text box for output, and a text box
for input.

Do I need to create a Process object and redirect it's input and output
from/to these boxes? I've tried this but it's not working, so any good
examples would be appreciated.

Also, I'm not sure what call I should be using in my ProcessStartInfo.
Should it be "cmd.exe" with the "/C" argument. Can I then continue to read
and write to this process?

Any help would be much appreciated.

Tobes
 
Do I need to create a Process object and redirect it's input and output
from/to these boxes? I've tried this but it's not working, so any good
examples would be appreciated.

Also, I'm not sure what call I should be using in my ProcessStartInfo.
Should it be "cmd.exe" with the "/C" argument. Can I then continue to read
and write to this process?
If you just wrap cmd.exe, there is no much gain.
You just wrap the old commands, no unicode.

On the other side, you can wait for Monad to be ready :-)
http://www.microsoft.com/technet/community/chats/trans/windowsnet/wnet_120704
..mspx
 
Tobin Harris said:
Hi there folks,

I want to write a c# application that mimicks the Windows command prompt.
Basically, I want to write a better command prompt!

This is a classic computer programming task; UNIX has benefited from several
people who have written "shells" as these things are called.

Basically, what you're going to do is read a command and then...

....some commands will be interpreted directly by your program;

....commands that refer to .exe files will be processed by launching the file
itself as a process and waiting for it to end.

I can't give any technical advice, but you might want to see what you can
find out about the internals of bsh, csh, tcsh, ksh, etc. in UNIX.
 
I can't give any technical advice, but you might want to see what you can
find out about the internals of bsh, csh, tcsh, ksh, etc. in UNIX.

Thanks Micheal, that's a good idea too.

To start with, I mainly want to improve the existing shell, by allowing it
to be much bigger in screen-space, longer buffer history, better copy/paste,
multiple grouped windows and that kind of thing. But, a natural extension
would be to provide additional features accessible by scripting.

Tobin
 
Thanks for the reply Mrinal,
a. Why do you want to call standard cmd.exe via process class ? - since in
that case you will be getting nothing more than standard command
prompt .

I was just thinking of this as an easy way to execute existing commands such
as "dir" etc. Ok for starters, but I agree that later I'd probably want to
provide a custom command set. To start with, I mainly want to improve the
existing shell, by allowing it to be much bigger in screen-space, longer
buffer history, better copy/paste, multiple grouped windows and that kind of
thing.
b. When you start a process using Process class , it will essentially be a
separate process , you won't be able to communicate without creating a
proxy

Not sure I understand this. A proxy is a placeholder right (as in the Proxy
pattern)?
I think if you want to create a Better command prompt , you can look out
for
some API's , that you can access to acheive the task or some class to
inherit from to just override the standard methods and getting the work
done
i will see if i can get some relevant information and will pass it on .

Yeah, this might be the best way forward. Thanks for you help.

Tobin
 
Could be great, I wander when it will be ready!..

Timing was one of the questions. And this is the answer:
<<Monad will ship as a feature of Exchange 12 in 2H06 (target).Monad will
ship in Windows after that.>>
So, second half of 2006 with Exchange, in Windows later.
I don't like it, is way too far, but this is it, nothing I can do :-)
 
Hi Senthil,

Good work! Any ideas about how it could be made to work for things like
osql? I'll happily work on the project with you if you need help.

Tobin
 
Hi Tobin,

The control only focuses on providing a UI that acts like a command
shell. Every time the user enters a command and presses the return key,
it fires an event which you can listen to and do whatever you want.

I suppose osql is a command line environment that can execute SQL
queries? In that case, you can open a database connection on startup ,
execute the queries when you get the event and print out the results.

Regards
Senthil
 
Hi Senthil

Sorry, don't think I was clear enough. I couldn't get your application to
work for interactive command line programs. For example, typing "osql" at
your prompt should get me an Sql prompt. There's quite a lot of command line
programs that are "interactive" and I wandered if your tool could be made to
support these?

Thanks

Tobin
 
I still don't get you. I guess you want a better command line
environment that osql to execute SQL queries, right?
 
Hehe. Well, I actually want a better command line client for everything!
This means bigger, easier copy/paste, good command history tools, multiple
dockable prompts etc...

Your little app does a nice job, but I'd be interested to learn how to make
it behave a little more like the "real" command prompt. For example, I
can't get the following DOS commands to work...

time
date

I think it's because these two commands are interactive. They prompt the
user for more information. I was only using "osql" as an example, but this
is another command line program that is also interactive.

So, I'd want to tweak your command line tool to be able to work with DOS
programs that prompt the user for input. Does that make sense?

Thanks

Tobin
 
Back
Top