OT: Windows console history?

May 20, 2008
11,425
99
Syracuse, NY, USA
Maybe I should have known this, or did know it at some time in the distant past, but ...

If, in the same Windows console (TCC, CMD, PS), I run FTP.EXE ... close FTP.EXE ... run FTP.EXE again, the commands entered in the first FTP.EXE session are remembered in the second and can be recalled with Up/Down. The same goes for PowerShell and interactive NSLOOKUP.EXE sessions. So it seems that any given Windows console (regardless of who started it) has an app-specific history. Is this documented ... customizable? Does anything in the Win32 API relate to it?
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,469
88
Albuquerque, NM
prospero.unm.edu
Check out the properties for the shortcut you use to start your console session, specifically the "Options" tab. GetConsoleHistoryInfo() and SetConsoleHistoryInfo() are probably relevant too.

TCC maintains its own separate history, of course.
 
May 20, 2008
11,425
99
Syracuse, NY, USA
Yeah, I saw those. I had never paid much attention to them. The two functions you mentioned are only for set-up. Do you know an app actually uses the mechanism ... or how TCC manages not to use it?
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,469
88
Albuquerque, NM
prospero.unm.edu
Don't really know, but I think I can guess. That console history mechanism probably only applies to apps which use ReadFile() to get lines from the console. TCC doesn't; it reads individual keystrokes and assembles lines itself.
 
May 20, 2008
11,425
99
Syracuse, NY, USA
Don't really know, but I think I can guess. That console history mechanism probably only applies to apps which use ReadFile() to get lines from the console. TCC doesn't; it reads individual keystrokes and assembles lines itself.
NSLOOKUP doesn't import ReadFile. FTP does, but I'll bet only for reading scripts. I was thinking (maybe) data gets into the history via gets/wgets and (again maybe) it's those functions which are processing Up/Down. I'd like to know more about it.
 
May 20, 2008
11,425
99
Syracuse, NY, USA
Some of it is spelled out here: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/doskey.mspx?mfr=true
I think it applies to the "doskey" mechanism itself rather than to DOSKEY.EXE.

Certain character-based, interactive programs, such as program debuggers or file transfer programs (FTP), automatically use Doskey.exe. To use Doskey.exe, a program must be a console process and use buffered input. Program key assignments override doskey key assignments. For example, if the program uses the F7 key for some function, you cannot get a doskey command history in a pop-up window.

With Doskey.exe you can maintain a command history for each program you start, repeat and edit previous commands at the program's prompt, and start doskey macros created for the program. If you exit and then restart a program from the same Command Prompt window, the command history from the previous program session is available.
 
May 20, 2008
11,425
99
Syracuse, NY, USA
NSLOOKUP doesn't import ReadFile. FTP does, but I'll bet only for reading scripts. I was thinking (maybe) data gets into the history via gets/wgets and (again maybe) it's those functions which are processing Up/Down. I'd like to know more about it.

You were correct. I tried a few ways of getting a string from the keyboard in a console app ... wgets, _wgets_s, ReadFile, ReadConsole. The all put the string in the console's history (to be available to the next instance). No doubt those, and others, ultimately call ReadFile. It's no surprise I didn't see NSLOOKUP importing ReadFile; it uses fgets and is dynamically with MSVCRT.DLL.
 
Similar threads
Thread starter Title Forum Replies Date
vefatica Console popup windows don't work correctly Support 0
vefatica Undesired scrolling in Windows 10 enhanced console. Support 2
fishman@panix.com TCC v22 & the Windows 10 Console Support 5
I Windows 10 console does not allow alt-F4 alias to complete Support 1
T Wrong prompt in Windows command console Support 3
thorntonpg windows 11 Support 12
vefatica Windows 10 themes Support 0
J Take command does not start on Windows 10 Support 3
D How to? Windows Key-Left and Windows Key-Right Support 9
Joe Caverly PYTHON from Microsoft Windows Store Support 2
D Open Windows 10 Photos app from command line Support 11
vefatica Windows Terminal ... Pop-up location Support 1
Joe Caverly Windows Terminal and @SELECT Support 13
D Layout debugger windows Support 2
L LIST's pop-up search loses focus in a Windows Terminal window Support 15
nickles ANSI Colors Windows 7 no longer working Support 6
S Windows Server version not being detected correctly in TCMD 26RC2 Support 9
D Which is the latest version for Windows XP? Support 2
rconn News Windows 7 Support Support 0
Joe Caverly Windows Size is 80x0 Support 2
rconn Dropping Windows 7 support in Take Command / TCC v26 Support 8
G Taskbar Windows 10 Support 7
T Windows Terminal Support 2
Joe Caverly Windows Sensor Support 5
vefatica Windows 10 and line wrapping selection? Support 6
fishman@panix.com New Problem with later Windows 10 Support 10
CWBillow Upgrade Windows 10's effect on TCMD and TCC Support 3
T Take Command v21 on Windows Server Support 1
Bill de Haan "Sensitive Privilege Use" in Windows security auditing Support 7
Joe Caverly Create Windows Jobs and optionally attach processes to a job Support 17
Joe Caverly What version and Windows OS are you using? Support 3
A Windows 10 This app can't run on your PC Support 2
G 4NT on Windows 10 Support 3
vefatica Windows 10 version number? Support 6
vefatica How do I see Windows 10's ANSI in action? Support 3
A List windows with titles matching given pattern? Support 2
M New "pinned" attribute (since Windows 10 1709) Support 6
Emilio III TCMD Tab titles on Insider Windows Support 2
kb6ojs Want to start TCMD v20 with every Windows 10 bootup Support 3
E Cannot paste dollar sign into TCC on Windows 10 1803 Support 7
M TCC incorrect dir output since Windows 1803 Support 6
G Version 20.11 installed on Windows 10 problems Support 9
Per TCC/LE 14 64-bit won't start on Windows 10 Insider Preview 17063 (171213) Support 12
I tcmd versus tcc in Windows 10 Support 2
Dick Johnson DrawBox now broken in Windows 10? Support 6
CWBillow Editing in the root directory of windows 10 Support 6
CWBillow Clearing out the Windows Temp folder Support 2
H New command not working well in Windows 7 Support 4
H _winver shows 6.1 on windows 7 Support 7
Joe Caverly Windows x64 Support 4

Similar threads