Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Wimconsole

console cmd alternative windows

  • Please log in to reply
5 replies to this topic

#1 wim DC

wim DC

    Roar

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 2681 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Python

Posted 08 May 2012 - 12:03 AM

Recently I got so fed up with the windows console I went to look for alternatives.
Turned out to be pretty hard to find a decent alternative >that's free<. Take command, Powercmd (Love it how it says "free download" on the site, but then asks for a license upon running - Download is free, doing something with the download isn't -.-) both cost money, so no option.
Unfortunately these 2 are in my opinion the only 2 decent ones.

Then there's Console(2) which is praised so much. http://sourceforge.n...ojects/console/
No idea why they say "great tool for developers", "extremely useful", "awesome",... It's just as bad as cmd.exe, just a different look.
Having to navigate to a folder 5 levels deep, and I don't know the exact path. I still end up doing 'dir', CD'ing 1 folder deep. 'dir' to see the new subfolders, cd again, dir, cd, dir, cd, dir, cd to FINALLY reach the destination because the tab completion only completes depending on the current working dir and does not care what has already been typed (okay it does, if you use backslashes. I personally never use those. too hard to type on an azerty keyboard).
And for tab completion to work properly you better know at least the first letter or you end up cycling trough every single folder - and you properly tab right over the folder you were supposed to get. Meaning you can go for another lap or backspace the current suggestion out and start typing.

me.rantOver();

Anyway, So I just made my own console in Java, implementing everything that I care about.
(Screenshots improve more the lower you go in the post. This was the first implementation of console, newer versions are added lower with more features)
0-simple.png

Implemented Features:
Autocomplete, triggered by pressing ANY key except ESC, arrow up/down, and enter:
1-autocomplete.png
new autocomplete gets shown after a space for passing parameters:
2-java.png

Tab completion: Pressing tab will take the first element of the autocomplete popup (excluding ../).
3-tab.png

Running a bat file / exe / java / anything:
4-running.png
The input field remains active - any input typed when something is running will be send to the running program, NOT to the console.

Kill running processes:
7-kill.png
You'll always see (at least) 2 processes being killed. The process you've started (bat / java /exe / ...) + in the background I use cmd.exe, so that's also killed

Input, output and errors have their own color:
6-wrong.png
Right click menu:
8-contextmenu.png
change colors:
9-colorchooser.png 10-color-result.png



----New Version-----
Tabs
Tabs can be added by clicking the button on the right of the tabs.
Middle clicking a tab closes it. No middle mouse button? Though! :P
Right click to change the tab name.
11-tabs.png



----New Version-----
History
History list on the right of the screen. Clicking or using arrow keys to set the command in the input field.
12-history.png


Autocomplete for parameters / arguments / options of commands
After launching for the first time a command directory with .command files is created.
If you want to add parameter autocomplete for your commands you just need to create a text file with all the parameters in it. Then name the file '<command>.command'.
14-configure-command.png
Parameters / options starting with '-' will not be shown untill an '-' is actually written.
You can test this with the default built in 'mvn' command. Type 'mvn ' and you'll get autocompletes for clean, install, package, .... Type '-' and you get all the options.
13-command-completes.png

Autocomplete for files on the PATH
On startup, all files on all directories specified in the PATH system variable are scanned.
When typing, use "@x" to get assistance for files on the path. (ipconfig, java, ping, are all files on the path. Which is why you don't need to 'cd' to them first.)
Since a lot of files can be on the path. (I got over 3000), you need to type at least 1 letter for the autocomplete to show.
15-pathfiles.png
Note: Files without extension need to be surrounded by quotes or Windows thinks it's an acutal command. This is windows default behaviour. Not Wimconsole's. If you select a path file trough autocomplete and the file has got no extension, it will be automatically surrounded with quotes. If you use the autocomplete more as guidance and you actuallly type the whole filename, then you'll need to manually add quotes or Windows will see it as command.


Since it's just a normal textPane, selecting, copying and pasting with CTRL+C and CTRL+V works like it's expected to.

Please try it if you ever use the windows console.
If you get a popup saying:

An unexpected error has occured in the background. A file "Console-errors.txt" has been created. Please send it to the author.

Well, pretty clear what happened then eh ;) Next to the main jar should hopefully be the txt file. It only contains the stacktrace. Just post it as reply here plase.

Weird or unexpected behaviour? Post down here.


Notes
Note1: to kill a process you must press escape. Not CTRL+C like in cmd.exe. You may consider this as unexpected behaviour, but I prefer to keep it this way since CTRL+C is for copy.
Note2: There is a history using up and down arrow keys. Up and down works as followed:
if autocomplete window is open: cycle trough the options.
if it's not open: cycle trough history.
To close the autocomplete popup -> escape
(History is currently infinite, I should probably limit it)
Note3: Use double quotes for paths with spaces in it. Only 1 exception: if your command starts with 'cd ' no quotes are required. Whatever comes after 'cd ' will be seen as 1 full path.
Note4: You're quite free in using forward slashes or backward slashes. Commands like this:
cd C:/java-software\\\apache-tomcat-7.0.26\//////bin\
Should be executed 'normally'
Note5: Reason for being a zip-file is that it also contains a required library.
+--wimConsole.jar
|
+--lib
  |
  +--commons-io-2.3.jar

Run with wimConsole.jar.
I may remove the library later as of the 190kB zip file, only 33kB is actually my console. The rest is the library.

Library is removed. Just a single jar now.

Note6: The first nine, or so, screenshots were taken with 14 font size. That has been reduced to 12.
Note7: It may be almost needless to say, but this java program only works in windows mainly due to the cmd.exe requirement and the way I deal with directory locations.


Next feature(s) to be added:
-tabs / Implemented
-remember the changed settings (Only colors so far) / Implemented - upon launching a "settings.wim" file is created and color choices are stored there. Delete file to go back to defaults.
-clear screen command / Implemented -Typing 'clear' or 'CLS' (case insensitive) will clear the console.
-panel on the side, showing history / Implemented-
-add support for command parameter autocomplete. (eg. typing "ipconfig -" should list all possible options) Implemented


Known bug(s)
The autocomplete window does not always hide when the console window loses focus. Fixed
Reading output/errors currently happens per line. If a line is not finished it is not yet shown at the user.
Problem:
Run this bat-file:

@echo off
echo Hi
set /P parameter=Type anything:
You'll only see "Type anything" after having entered to complete the line.
Is currently fixed in my local source. But having some formatting issues now...
Fixed

Running something that acts like a new console in the console. Say -for example- connecting trough mysql, or using the play! framework, or windows' ftp command. Does not work properly.
I am not receiving input, nor am I able to send to the mysql in the cmd.exe running in the background.
Not sure if I can fix this.
telnet is also weird in its behaviour. Pinging is normal.


- For ANY error / unexpected behaviour like the bug above, slam the command with CTRL+Enter and it will be executed in windows' command prompt


Download:
Jar-file: Attached File  wimConsole.jar   55.51KB   154 downloads
Exe-file (Same thing - still needs java installed - just has an icon): Attached File  wimConsole.zip   78.26KB   153 downloads
  • 1

#2 wim DC

wim DC

    Roar

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 2681 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Python

Posted 08 May 2012 - 02:14 AM

-Tabs are added. Turned out to be only a 1-1,5 hr job to implement that.
-(Color) Settings are saved in a file.
-Clear command implemented
-History added, and 'fixed' slow execution times while I was at it. Just pressing enter (empty command) would take 300-350ms before, now 90-100ms.
  • 0

#3 RhetoricalRuvim

RhetoricalRuvim

    JavaScript Programmer

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1310 posts
  • Location:C:\Countries\US
  • Programming Language:C, Java, C++, PHP, Python, JavaScript

Posted 08 May 2012 - 04:58 AM

Wouldn't you do something like this in cmd?:
taskkill /F /IM explorer.exe

  • 0
Regards,
RR

#4 wim DC

wim DC

    Roar

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 2681 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Python

Posted 08 May 2012 - 05:50 AM

Yea, I do
taskkill /F /T /PID 1234
by doing /T it kills the whole tree, so also the processes started trough cmd.exe. I also prefer using the pid instead of the name since the user may have another cmd.exe open on his/her own.

Hardest thing is to find the PID in Java of the cmd.exe that I am using. I need to do 3 tasklist commands to filter out the correct one.
  • 0

#5 RhetoricalRuvim

RhetoricalRuvim

    JavaScript Programmer

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1310 posts
  • Location:C:\Countries\US
  • Programming Language:C, Java, C++, PHP, Python, JavaScript

Posted 09 May 2012 - 06:06 PM

By the way, in DOS, and in older versions of Windows, the shortcut for terminating the program is Ctrl+Break , unlike in new Windows, where the shortcut is Ctrl+C .
  • 0
Regards,
RR

#6 wim DC

wim DC

    Roar

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 2681 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Python

Posted 16 May 2012 - 05:01 AM

Major code refactor - Hopefully not noticable :)
Path files added to autocomplete.
CTRL+Enter added to execute the current command in Windows' own commandprompt instead of Wimconsole.
  • 0





Also tagged with one or more of these keywords: console, cmd, alternative, windows