This is part of a minimalist shell I am writing in AHK.
Certainly not an enhancement of the original, just a basic copy.
But as you have the source, it's easily expanded, I might add an aliases function in the future, when I have time.
Feel free to change/optimize/enhance/use it as you see fit, would be nice if you could post your code here as well though so we can all benefit.
Features:
*History of entered commands (default 10 but can be changed easily by editing the ini).
*If a path or drive is entered (eq. c:\ or c:\windows) it will open the folder in explorer
* File selector
* Entering "clear" (without quotes) clears the history.
The history is saved in an inifile in the script directory using the script name as its base and created if not already in existance when the script is first run.
Note! this script will keep on running in the tray untill closed from the tray menu
#SingleInstance force dbase := getscriptname() ; get the base name of this program without the extension ini = %A_ScriptDir%\%dbase%.ini ; and make a ini file based on the script name and path IfNotExist, %ini% ; if there is no ini file yet make one makeini(ini) GoSub dorun return DoRun: IniRead, CommandHistory, %ini%, history, CommandHistory IniRead, maxhistory, %ini%, history, maxhistory, 10, ; set the default to 10 if CommandHistory = ERROR CommandHistory = StringReplace, CommandHistory, CommandHistory, || , |, A StringRight, TT, CommandHistory, 1 if TT = | StringTrimRight, CommandHistory, CommandHistory, 1 OrgHistory = %CommandHistory% sort, CommandHistory, D| count = 0 Gui, Add, ComboBox, W260 vCommand, %CommandHistory% Gui, Add, Button,ys , .... Gui, Add, Button,ys default, Run Gui, Show, W360 , Run Box return Button....: FileSelectFile, Command if Command = return GoSub ButtonRun return ButtonRun: if Command = ; if the routine was not called from the file select do a submit Gui, Submit if Command = ; if nothing was entered then just forget it return check = StringMid, check, Command, 2, 2 if check = :\ ; if command contains :\ and no dot it must be a path so let explorer handle it IfNotInString, Command, . expl = explorer.exe /n,/e, if Command <> clear Run, %expl%%Command%, ,UseErrorLevel if ErrorLevel = ERROR { MsgBox, "%Command%" could not be found or executed Gui, destroy return } CommandHistory = IfNotInString, OrgHistory, %Command% { loop, parse, OrgHistory, | { _this = %A_LoopField% if _this = continue CommandHistory = %CommandHistory%|%A_LoopField% count += 1 if count = %maxhistory% break } CommandHistory = %Command%|%CommandHistory%| if Command = clear CommandHistory = "" IniWrite, %CommandHistory%, %ini%, history, CommandHistory } ; do some cleaning up CommandHistory = _this = OrgHistory = Command = expl = Gui, Destroy return makeini(ini){ ; make an inifile IniWrite, 10, %ini%, history, maxhistory ; set the default to 10 items in the history IniWrite, "", %ini%, history, CommandHistory ; just an empty string to start of with } GetScriptName(){ ; thanks for the tip Goyyah SplitPath, A_ScriptFullPath,,,,Name, Return Name }