Command Prompt Replacement

snarfblam

Mega-Ultra Chicken
Joined
Jun 10, 2003
Messages
1,832
Location
USA
User Rank
*Expert*
Does the idea of a Windows command prompt replacement program pique anyones interest? There are many desktop replacement programs and it seems that plenty of people like them. They dont do much for me because I dont really use the desktop.

I would be a big fan of the Windows command prompt but it just seems crippled and obsolete. The syntax tends to be awkward and extensibility is minimal. If you want to add your own command you have an option between the batch file, which seems to be the clumsiest "programming language" there is, or write an entire executable to serve the purpose of that single command. Most importantly, it is just plain ugly. Hence, the need for a replacement.

I have already begun to write a command prompt replacement, but Im wondering just how much interest there would be, and if there is interest, would anyone has any suggestions or criticisms. The syntax is... unique... a mixture of different languages with the goal of being simple to write, simple to interpret, and concise. It has the added bonus of being able to create and manipulate .Net objects through the command line (in a manner similar to the Immediate window in Visual Studio). Commands are primarily function calls rather than shell commands, and functions would be provided to accomplish common shell commands. It could be docked as an appbar (like the task bar) so that it is always at your finger tips.

This is a sample of what you might type into the prompt (this is all subject to change, though):
Code:
[COLOR=Green]/ This is a comment. /

/ Delete a file.
  You can use "escaped strings" and unescaped strings.
  Exclamation marks identify functions.
/
[/COLOR]!Del(C:\Windows\ThatFileImDeleting.txt);

[Color=Green]/ Change directory.
  There will probably be shortcuts for very
  common commands like this.
/[/Color]
!CD("System32");

[Color=Green]/ Get text from the user, and display the text in all caps.
  The assignment operator is a colon.
/[/Color]
$text: !GetLine();
$text: !ToUpper($text);
!WriteLine($text);

[Color=Green]/ Play with .Net objects. This adds a world of
  already existing functionality to the prompt.
  The carat identifies a handle (as it does in
  C++/CLI). The asterix is the instantiation operator.
/[/Color]
^myForm: *System.Windows.Forms.Form();
^myForm.Text: "Holy great goodness! A Form!";
^myForm.ShowDialog();
 
Theres already Windows Script Host (wsh), which can be like batch files but use a higher level language - albeit closer to VB6 and not made for .NET. I havent heard if there are any plans on adding .NET support to something like WSH - maybe some else has?

I like WSH for when I need it. Luckily, I dont need it very often. Less often, but still used, is the old BAT file. I can muck around with what I need which, thankfully, isnt very much. :)

It might be fun to make a language of your own though - who knows?

-ner
 
Nerseus said:
Theres already Windows Script Host (wsh), which can be like batch files but use a higher level language
Ive never used WSH, but it looks like it would be intended for batch processes and automation, and the syntax seems to be a bit bulky as well as mixed (a variety of languages embedded in XML).

The goal of my command prompt is to be a major, if not primary, interface with the operating system, as a shell command prompt should be. A key concept in this is immediate execution. WSH is very suitable for deferred execution, but doesnt seem to have the functionality necessary for immediate execution. Im looking for something that unifies immediate execution and deferred execution in a streamlined environment.

PlausiblyDamp said:
If this is for real use rather than a learning exercise then http://www.peterprovost.org/archive...1/11/10763.aspx points to the upcomming Monad from MS...
I am a hobbyist programmer. Ninety (or more likely ninety-nine) percent of program code that I write reproduces existing functionality available in other code and software. Often I do this for the purpose of highly customized software for the sake of efficiency or convenience. Most often it is, as you think of it, a learning exercise. A question I love to ask myself is "What would I have done differently?" and I love it when I can answer through my own manifestations. My command prompt would be a combination of customized software and my take on what could have been done differently.

A big inspiration for me is the Logo programming language (specifically the Terrapin dialect, back in the eighties--I suppose that in a lot of ways I am just plain old fashioned). Logo programs had no explicitly defined entry point. Rather, the programmer constructed a set of functions that were generally useful on their own, with a small group of main functions that exercised the "programs" chief functionality through the other functions. Computers have come a long way and can do a lot more, but there is no reason that a large portion of what the computer can do cant still be accessed through the same approach.

The other inspiration came from a number of shortcuts I use to make things happen faster on my computer. One thing Ive done is created a "Links" folder full of program shortcuts, which I added to the Include environment variable. I can go to the Run window or the command prompt and type an alias for most programs on my computer and they pop up, saving me the trouble of sorting through the start menu or explorer. Another thing Ive done is, using Tweak UI, added a number of search shortcuts to Internet Explorer. Although I use FireFox, I have an address bar on the task bar, and I can type "Google Megan White is a robot" to find information about Megan White, the robot, or "Lyrics Whoever You Are" to find the lyrics of my favorite Geggy Tah song, or "Define intellectual" to see descriptions of myself, or "Wiki Microsoft .Net" to look at a Wikipedia article on Microsofts .Net platform. I would love to have conveniences like this combined into a command prompt.

Either of these could be done in a round-about manner with the Windows command prompt, but why not a prompt that has a built in feature to make program aliases?
Code:
!MakeAlias(Word, C:\Program Files\Microsoft Office 200\Winword.Exe");
!Run(Word); [color=green]/ I will make shortcut syntax for common commands like this /[/color]
And with the ability to define parameterized functions quickly from the prompt...
Code:
!Google($Search){
    $URL: !Replace(
        http://www.google.com/search?q=%search%&hl=en&lr=&safe=off&start=10&sa=N,
        "$search%",
        $Search
    );
 
    !Shell($URL);
}
We can quickly and easily define a function to perform a Google search in a simple, concise language, without opening notepad and saving a script file or a batch file.

Bringing things back to Monad, I saw a video of Monad in action and was fairly impressed. What would really separate my command prompt from Monad is that it mine would be much more traditional as well as more procedural in spirit (as opposed to the "verbose," pipe-lined approach of Monad). If we add a grep function, a sort function, and a format function that take advantage of .Net Reflection, we can bring things up to par with Monad. Ultimately it is a matter of preferred ambience and features.

So, I guess this is a combination of a "learning experience" as well as a different take on the "Command Prompt of the future." I, for one, certainly intend to use my command prompt. Whether or not it finds other fans, I suppose, determines just how much work I will put into it.
 
Personally, I prefer the unix/tcsh/bash way of doing things. Microsoft command Shell (MSH) seems like a good, window-y compromise and it comes with Longhorn. Ive played with the MSH beta a little, it was pretty cool. From a learning experience there isnt much better than writing your own shell -- I had to write one in C in college and learned a great deal from that experience.

If you dont know much about unix/linux command shells I would recommend you do some research. As far as finding other fans goes...be forewarned, people are fanatical about their command shells.
 
people are fanatical about their command shells
Of course they are. Why else would I spend so much time writing the one that makes the most sense to me?

But then there are those who do not use a command shell. Perhaps if there were an easy-to-use shell with familiar php/c# style syntax, it would attract those who dont make much use of command prompts. To be certain, Im not expecting to draw people away from their unix shell, but it wouldnt surprise me if there were plenty of people who dont use a command prompt simply because they dont have a decent one at their finger tips. And then, at the very least, it offers alternative syntax to that of Monad.
 
marble_eater said:
...but it wouldnt surprise me if there were plenty of people who dont use a command prompt simply because they dont have a decent one at their finger tips.
That about sums it up. In fact, in windows Im one of those people. Cmd.exe is just so clunky when you are used to Unix Shells. Batch files cant do nearly as much as bash shell scripts. Ive highly customized by cmd.exe with aliased batch files and windows ports of common gnu utilities such as ls. But that doesnt help much when I go to the lab at work. And batch files are still practically useless.

I almost did something like this a year or two ago but decided to hold off and see how Monad turned out. Id be willing to give your shell a try as you roll out releases becuase, lets face some facts, Windows cmd.exe sucks and anything would be an improvement. I even think it would be great to have several shells for windows just like there are for unix systems. And even further, the reason there are so many shells for Unix is becuase each one is an "improvement" for the person who invented it. Someone who had an itch to scratch just like youve got right now. (and time and enough geekiness to pull it off :))

I look forward to your first release.
 
Back
Top