From: m on
LOL! most of us just know the registry hacks for this stuff; but I am glad that there _is_ an API exported somewhere for this stuff ;)
"Jonathan de Boyne Pollard" <J.deBoynePollard-newsgroups(a)NTLWorld.COM> wrote in message news:IU.D20100125.T034146.P6795.Q0(a)J.de.Boyne.Pollard.localhost...
It only inherits the parent shell's command history if the shell makes provisions for that - typically by keeping the command history in a file associated with the tty name, so the new child shell can find it.


... which is unnecessary on Win32, since command history is not (in the system-supplied command interpreter at any rate) a function of the command interpreter program.

Since cmd.exe keeps its history in process private memory, though, there's no way for the child cmd.exe to inherit that.

No, it really doesn't. This is one place where the designs of the Win32 API and of the POSIX API differ. Console aliases and command history are actually directly part of the console, not implemented within individual command interpreter processes. (Of course, for command interpreters such as Take Command and 4NT, which implement their own command editing, aliasing, and history mechanisms, they are.) There is a mostly undocumented console API (AddConsoleAlias, GetConsoleCommandHistory, SetConsoleHistoryInfo, and so forth) that is used by CMD for accessing them.

From: Michael Wojcik on
Jonathan de Boyne Pollard wrote:
>
>> Since |cmd.exe| keeps its history in process private memory, though,
>> there's no way for the child |cmd.exe| to inherit that.
>>
> No, it really doesn't. This is one place where the designs of the Win32
> API and of the POSIX API differ. Console aliases and command history
> are actually directly part of the console, not implemented within
> individual command interpreter processes. (Of course, for command
> interpreters such as Take Command and 4NT, which implement their own
> command editing, aliasing, and history mechanisms, they are.) There is
> a mostly undocumented console API (|AddConsoleAlias|,
> |GetConsoleCommandHistory|, |SetConsoleHistoryInfo|, and so forth) that
> is used by |CMD| for accessing them.

Thanks for the correction. I should have checked that before posting.

--
Michael Wojcik
Micro Focus
Rhetoric & Writing, Michigan State University