1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

OT: Windows console history?

Discussion in 'Support' started by vefatica, May 29, 2014.

  1. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,883
    Likes Received:
    29
    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?
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,287
    Likes Received:
    39
    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.
     
  3. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,883
    Likes Received:
    29
    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?
     
  4. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,287
    Likes Received:
    39
    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.
     
  5. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,883
    Likes Received:
    29
    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.
     
  6. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,883
    Likes Received:
    29
    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.

     
  7. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,883
    Likes Received:
    29
  8. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,883
    Likes Received:
    29
    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.
     

Share This Page