Why do `cmd / k` and` cmd / c` remember the history of ready-made cmd subprocesses?

Here is the command I executed:

>cmd /k
>echo 1
1

>echo 2
2

>echo 3
3

>exit /b

>cmd /c "doskey /history"
echo 1
echo 2
echo 3
exit /b

>

(checked on windows 7x64). According to the process researcher, it cmd /klaunches a subprocess (not a thread). Therefore, after the process comes out, I expect it to clear its stuff from memory. This happens on 3/4 / .. generated by cmds,, for /fwith a batch file being called.

+4
source share
1 answer

Short version:

The console window processes the command history

In detail:

Command line window processes are as follows:

conhost.exe
--- doskey.exe
------ cmd.exe
--------- any subprocesses (in your case cmd /k)


Microsoft:

... , , .

Doskey.exe. doskey , .

Doskey conhost.exe, , . .

cmd , , CMD doskey


Update:

MC ND, Windows XP/2003/Vista/2008 csrss.exe. Windows 7, conhost.exe -

+7

Source: https://habr.com/ru/post/1673520/


All Articles