Is there a global, persistent CMD history? The Next CEO of Stack OverflowWhat's the difference between .cmd and .bat files?How to launch a new cmd window from an existing cmd window?Avoid to keep command in historyVisual APP to run CMD commandsIs there a Windows CMD equivalent of Unix shell's exec?Finding forgotten RDP sessions?Windows PowerShell - How to view commands history date/timeIs there an easy way to alias PowerShell in cmd?Disabling a CMD command for a UserProgram files on Windows Server part of User profile?
Axiom Schema vs Axiom
Do I need to write [sic] when a number is less than 10 but isn't written out?
The exact meaning of 'Mom made me a sandwich'
When you upcast Blindness/Deafness, do all targets suffer the same effect?
Writing differences on a blackboard
What flight has the highest ratio of timezone difference to flight time?
Help understanding this unsettling image of Titan, Epimetheus, and Saturn's rings?
Is there always a complete, orthogonal set of unitary matrices?
Can we say or write : "No, it'sn't"?
Example of a Mathematician/Physicist whose Other Publications during their PhD eclipsed their PhD Thesis
A small doubt about the dominated convergence theorem
Math-accent symbol over parentheses enclosing accented symbol (amsmath)
Legal workarounds for testamentary trust perceived as unfair
How is this set of matrices closed under multiplication?
Is it possible to replace duplicates of a character with one character using tr
Newlines in BSD sed vs gsed
Grabbing quick drinks
Is there a way to save my career from absolute disaster?
If Nick Fury and Coulson already knew about aliens (Kree and Skrull) why did they wait until Thor's appearance to start making weapons?
Find non-case sensitive string in a mixed list of elements?
Why did CATV standarize in 75 ohms and everyone else in 50?
Why do airplanes bank sharply to the right after air-to-air refueling?
Running a General Election and the European Elections together
I want to delete every two lines after 3rd lines in file contain very large number of lines :
Is there a global, persistent CMD history?
The Next CEO of Stack OverflowWhat's the difference between .cmd and .bat files?How to launch a new cmd window from an existing cmd window?Avoid to keep command in historyVisual APP to run CMD commandsIs there a Windows CMD equivalent of Unix shell's exec?Finding forgotten RDP sessions?Windows PowerShell - How to view commands history date/timeIs there an easy way to alias PowerShell in cmd?Disabling a CMD command for a UserProgram files on Windows Server part of User profile?
Sometimes I forget how the exact syntax of a CMD command looks and then I would like to search my own CMD history. Clearly, within the same session, you can browse it with the up and down arrow keys but what about the history of former CMD sessions? Is there a file, a log the history gets written to or does it all go to digital Nirvana?
Thanks!
windows windows-command-prompt history command
add a comment |
Sometimes I forget how the exact syntax of a CMD command looks and then I would like to search my own CMD history. Clearly, within the same session, you can browse it with the up and down arrow keys but what about the history of former CMD sessions? Is there a file, a log the history gets written to or does it all go to digital Nirvana?
Thanks!
windows windows-command-prompt history command
You can hijack the exit command to automatically save a log before exiting:doskey exit=doskey /history ^>^> C:pathtocmdhistory.log $T exit $*
but you'll need to figure out how to execute this automatically at each command prompt session startup. PS: Make sure the path of the log file is writable.C:
is not writable for a non-admin command prompt.
– ADTC
Jan 7 '18 at 5:00
@ADTC: AutoRun should handle 'each startup': superuser.com/a/302553/333316 or stackoverflow.com/a/17405182/2868801
– dave_thompson_085
Jun 3 '18 at 20:40
add a comment |
Sometimes I forget how the exact syntax of a CMD command looks and then I would like to search my own CMD history. Clearly, within the same session, you can browse it with the up and down arrow keys but what about the history of former CMD sessions? Is there a file, a log the history gets written to or does it all go to digital Nirvana?
Thanks!
windows windows-command-prompt history command
Sometimes I forget how the exact syntax of a CMD command looks and then I would like to search my own CMD history. Clearly, within the same session, you can browse it with the up and down arrow keys but what about the history of former CMD sessions? Is there a file, a log the history gets written to or does it all go to digital Nirvana?
Thanks!
windows windows-command-prompt history command
windows windows-command-prompt history command
asked Dec 17 '09 at 18:06
raoulssonraoulsson
1,85362729
1,85362729
You can hijack the exit command to automatically save a log before exiting:doskey exit=doskey /history ^>^> C:pathtocmdhistory.log $T exit $*
but you'll need to figure out how to execute this automatically at each command prompt session startup. PS: Make sure the path of the log file is writable.C:
is not writable for a non-admin command prompt.
– ADTC
Jan 7 '18 at 5:00
@ADTC: AutoRun should handle 'each startup': superuser.com/a/302553/333316 or stackoverflow.com/a/17405182/2868801
– dave_thompson_085
Jun 3 '18 at 20:40
add a comment |
You can hijack the exit command to automatically save a log before exiting:doskey exit=doskey /history ^>^> C:pathtocmdhistory.log $T exit $*
but you'll need to figure out how to execute this automatically at each command prompt session startup. PS: Make sure the path of the log file is writable.C:
is not writable for a non-admin command prompt.
– ADTC
Jan 7 '18 at 5:00
@ADTC: AutoRun should handle 'each startup': superuser.com/a/302553/333316 or stackoverflow.com/a/17405182/2868801
– dave_thompson_085
Jun 3 '18 at 20:40
You can hijack the exit command to automatically save a log before exiting:
doskey exit=doskey /history ^>^> C:pathtocmdhistory.log $T exit $*
but you'll need to figure out how to execute this automatically at each command prompt session startup. PS: Make sure the path of the log file is writable. C:
is not writable for a non-admin command prompt.– ADTC
Jan 7 '18 at 5:00
You can hijack the exit command to automatically save a log before exiting:
doskey exit=doskey /history ^>^> C:pathtocmdhistory.log $T exit $*
but you'll need to figure out how to execute this automatically at each command prompt session startup. PS: Make sure the path of the log file is writable. C:
is not writable for a non-admin command prompt.– ADTC
Jan 7 '18 at 5:00
@ADTC: AutoRun should handle 'each startup': superuser.com/a/302553/333316 or stackoverflow.com/a/17405182/2868801
– dave_thompson_085
Jun 3 '18 at 20:40
@ADTC: AutoRun should handle 'each startup': superuser.com/a/302553/333316 or stackoverflow.com/a/17405182/2868801
– dave_thompson_085
Jun 3 '18 at 20:40
add a comment |
7 Answers
7
active
oldest
votes
No, Windows command prompt history can't be saved when a session ends.
3
for real? how do you know this? Sorry for questioning you, I guess you are right but how can u know unless u programmed the damn thing ;)
– raoulsson
Dec 18 '09 at 0:08
7
Ok, let me rephrase :-) The Windows command interpreter ("cmd.exe") doesn't provide any support for saving/exporting/keeping history, of, if it does, Microsoft didn't document it and nobody was ever able to find it. You can of course try to work around that, like Sean suggested, but there's (or does appear to be) no built-in support for this.
– Massimo
Dec 18 '09 at 6:17
15
You can press F7 to see a history list of the current session.
– jftuga
Feb 14 '11 at 13:20
4
CURRENT session is the keyword here.
– Massimo
Aug 24 '15 at 5:42
2
You can see / save the history by runningdoskey.exe /history
(that's also where the F7 shortcut comes from, BTW) but there's no way to load it back up in your next session.
– Coderer
Feb 19 '16 at 9:45
|
show 2 more comments
Not natively but check out: http://mridgers.github.io/clink/ , makes cmd.exe much more productive. Quoting features from the project page:
Powerful Bash-like line editing from GNU's Readline library.
Superior path completion (TAB).
Paste from clipboard (Ctrl-V).
Support for the completion of executables/commands, and environment variables.
Undo/Redo (Ctrl-_ or Ctrl-X, Ctrl-U)
Improved command line history.
Persists across sessions.
Searchable (Ctrl-R and Ctrl-S).
History expansion (e.g. !!, !<string>, and !$).
Scriptable completion using Lua.
3
clink solved everything
– Still.Tony
Jan 20 '15 at 16:27
5
Any plans to include it by default in Windows? :D
– Jaime Hablutzel
Mar 1 '15 at 22:40
Can you set a~/.inputrc
when using clink? (and do you know whether it can be used Console or anything?)
– Mike H-R
Apr 20 '15 at 17:39
Apparently, see the doc github.com/mridgers/clink/blob/master/docs/clink.md.
– Baris Demiray
Dec 18 '15 at 9:29
... except aliases.clink
hatesdoskey
; forget all of your years-long and carefully-assigned aliases. that's why i stopped to use it. though i miss all the features.
– w17t
Jul 3 '17 at 17:31
|
show 1 more comment
Massimo is correct that your command prompt history does not persist across sessions. You could manually grab this before closing your prompt by typing doskey /history > history.txt
Or... you could use PowerShell as your CMD prompt, and follow this post to persist your history across sessions.
add a comment |
You can use clink.
Clink combines the native Windows shell cmd.exe with the powerful command line editing features of the GNU Readline library, which provides rich completion, history, and line-editing capabilities.
Easiest way to install clink is using chocolatey. Once you install chocolatey, you can install clink by typing
choco install clink
Starting from the next time you start cmd.exe, it should store history across sessions.
Finally decided to giveChocolatey
a shot because of this post. Installation was as easy as ofbrew
in macOS. And now I have a Bash-like command prompt in Windows!
– TranslucentCloud
Sep 23 '16 at 7:39
add a comment |
It is possible to save the current history to file,
`$ doskey /history > somefile.txt`
But it seems there is no way to load it back as history.
It is possible only to use a command line argument to load and execute all lines,
cmd.exe /K somefile.txt
, what can be useful to load a list of doskey macros.
This invocation could be included in a shortcut so you don't need to type it everytime; this reference has some additional info on this approach.
There is a similar question on Superuser that bring some alternatives, including clink, as suggested by @RobertBak.
Hmm, to load it back into history, wouldn't you simply need to save it to a .bat file and run it?
– Pacerier
Aug 23 '15 at 22:10
1
@Pacerier running the commands again would surely include them back in the history, but it likely would have large side-effects. Imagine that you delete some files through the shell and then recreate them outside the shell through a long and painful process. Reloading the history through your procedure would unexpectedly delete the files again.
– mMontu
Aug 24 '15 at 11:00
@Pacerier you realize "run it" does mean executing all those commands, right? It's not simply loading them into history, but actually letting them have some effects on your system.
– ADTC
Jan 7 '18 at 5:07
add a comment |
Command History:
To enable a command history (that can be accessed using the up and
down arrow keys) just execute doskey at the command
prompt. For example, to create a command history of 100 elements:
doskey /listsize=100
ref:https://users.cs.jmu.edu/bernstdh/web/common/help/ntshell.php
3
That doesn't answer the question at all??
– Chopper3
Feb 14 '11 at 13:27
1
Not works on Windows 10.
– TranslucentCloud
Sep 23 '16 at 7:27
add a comment |
clink is nice and the author publishes a chocolatey package on every release, however I would suggest DeepBlueCLI.
You can use https://github.com/sans-blue-team/DeepBlueCLI to set-up Windows Security Event ID 4688.
For PowerShell, DeepBlueCLI also uses module logging (PowerShell event 4013) and script block logging (4104). It does not use transcription.
The added benefit is that it logs the hash of the command line exe in AppLocker event log. Source: https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/manage/component-updates/command-line-process-auditing
Also, because this solution uses the Windows Event Log infrastructure, you can query it through WMI or PowerShell Get-EventLog
. With clink, you have to learn another tool in order to detect system- or network-wide patterns of behavior.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f95404%2fis-there-a-global-persistent-cmd-history%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
7 Answers
7
active
oldest
votes
7 Answers
7
active
oldest
votes
active
oldest
votes
active
oldest
votes
No, Windows command prompt history can't be saved when a session ends.
3
for real? how do you know this? Sorry for questioning you, I guess you are right but how can u know unless u programmed the damn thing ;)
– raoulsson
Dec 18 '09 at 0:08
7
Ok, let me rephrase :-) The Windows command interpreter ("cmd.exe") doesn't provide any support for saving/exporting/keeping history, of, if it does, Microsoft didn't document it and nobody was ever able to find it. You can of course try to work around that, like Sean suggested, but there's (or does appear to be) no built-in support for this.
– Massimo
Dec 18 '09 at 6:17
15
You can press F7 to see a history list of the current session.
– jftuga
Feb 14 '11 at 13:20
4
CURRENT session is the keyword here.
– Massimo
Aug 24 '15 at 5:42
2
You can see / save the history by runningdoskey.exe /history
(that's also where the F7 shortcut comes from, BTW) but there's no way to load it back up in your next session.
– Coderer
Feb 19 '16 at 9:45
|
show 2 more comments
No, Windows command prompt history can't be saved when a session ends.
3
for real? how do you know this? Sorry for questioning you, I guess you are right but how can u know unless u programmed the damn thing ;)
– raoulsson
Dec 18 '09 at 0:08
7
Ok, let me rephrase :-) The Windows command interpreter ("cmd.exe") doesn't provide any support for saving/exporting/keeping history, of, if it does, Microsoft didn't document it and nobody was ever able to find it. You can of course try to work around that, like Sean suggested, but there's (or does appear to be) no built-in support for this.
– Massimo
Dec 18 '09 at 6:17
15
You can press F7 to see a history list of the current session.
– jftuga
Feb 14 '11 at 13:20
4
CURRENT session is the keyword here.
– Massimo
Aug 24 '15 at 5:42
2
You can see / save the history by runningdoskey.exe /history
(that's also where the F7 shortcut comes from, BTW) but there's no way to load it back up in your next session.
– Coderer
Feb 19 '16 at 9:45
|
show 2 more comments
No, Windows command prompt history can't be saved when a session ends.
No, Windows command prompt history can't be saved when a session ends.
answered Dec 17 '09 at 18:11
MassimoMassimo
53.1k44170282
53.1k44170282
3
for real? how do you know this? Sorry for questioning you, I guess you are right but how can u know unless u programmed the damn thing ;)
– raoulsson
Dec 18 '09 at 0:08
7
Ok, let me rephrase :-) The Windows command interpreter ("cmd.exe") doesn't provide any support for saving/exporting/keeping history, of, if it does, Microsoft didn't document it and nobody was ever able to find it. You can of course try to work around that, like Sean suggested, but there's (or does appear to be) no built-in support for this.
– Massimo
Dec 18 '09 at 6:17
15
You can press F7 to see a history list of the current session.
– jftuga
Feb 14 '11 at 13:20
4
CURRENT session is the keyword here.
– Massimo
Aug 24 '15 at 5:42
2
You can see / save the history by runningdoskey.exe /history
(that's also where the F7 shortcut comes from, BTW) but there's no way to load it back up in your next session.
– Coderer
Feb 19 '16 at 9:45
|
show 2 more comments
3
for real? how do you know this? Sorry for questioning you, I guess you are right but how can u know unless u programmed the damn thing ;)
– raoulsson
Dec 18 '09 at 0:08
7
Ok, let me rephrase :-) The Windows command interpreter ("cmd.exe") doesn't provide any support for saving/exporting/keeping history, of, if it does, Microsoft didn't document it and nobody was ever able to find it. You can of course try to work around that, like Sean suggested, but there's (or does appear to be) no built-in support for this.
– Massimo
Dec 18 '09 at 6:17
15
You can press F7 to see a history list of the current session.
– jftuga
Feb 14 '11 at 13:20
4
CURRENT session is the keyword here.
– Massimo
Aug 24 '15 at 5:42
2
You can see / save the history by runningdoskey.exe /history
(that's also where the F7 shortcut comes from, BTW) but there's no way to load it back up in your next session.
– Coderer
Feb 19 '16 at 9:45
3
3
for real? how do you know this? Sorry for questioning you, I guess you are right but how can u know unless u programmed the damn thing ;)
– raoulsson
Dec 18 '09 at 0:08
for real? how do you know this? Sorry for questioning you, I guess you are right but how can u know unless u programmed the damn thing ;)
– raoulsson
Dec 18 '09 at 0:08
7
7
Ok, let me rephrase :-) The Windows command interpreter ("cmd.exe") doesn't provide any support for saving/exporting/keeping history, of, if it does, Microsoft didn't document it and nobody was ever able to find it. You can of course try to work around that, like Sean suggested, but there's (or does appear to be) no built-in support for this.
– Massimo
Dec 18 '09 at 6:17
Ok, let me rephrase :-) The Windows command interpreter ("cmd.exe") doesn't provide any support for saving/exporting/keeping history, of, if it does, Microsoft didn't document it and nobody was ever able to find it. You can of course try to work around that, like Sean suggested, but there's (or does appear to be) no built-in support for this.
– Massimo
Dec 18 '09 at 6:17
15
15
You can press F7 to see a history list of the current session.
– jftuga
Feb 14 '11 at 13:20
You can press F7 to see a history list of the current session.
– jftuga
Feb 14 '11 at 13:20
4
4
CURRENT session is the keyword here.
– Massimo
Aug 24 '15 at 5:42
CURRENT session is the keyword here.
– Massimo
Aug 24 '15 at 5:42
2
2
You can see / save the history by running
doskey.exe /history
(that's also where the F7 shortcut comes from, BTW) but there's no way to load it back up in your next session.– Coderer
Feb 19 '16 at 9:45
You can see / save the history by running
doskey.exe /history
(that's also where the F7 shortcut comes from, BTW) but there's no way to load it back up in your next session.– Coderer
Feb 19 '16 at 9:45
|
show 2 more comments
Not natively but check out: http://mridgers.github.io/clink/ , makes cmd.exe much more productive. Quoting features from the project page:
Powerful Bash-like line editing from GNU's Readline library.
Superior path completion (TAB).
Paste from clipboard (Ctrl-V).
Support for the completion of executables/commands, and environment variables.
Undo/Redo (Ctrl-_ or Ctrl-X, Ctrl-U)
Improved command line history.
Persists across sessions.
Searchable (Ctrl-R and Ctrl-S).
History expansion (e.g. !!, !<string>, and !$).
Scriptable completion using Lua.
3
clink solved everything
– Still.Tony
Jan 20 '15 at 16:27
5
Any plans to include it by default in Windows? :D
– Jaime Hablutzel
Mar 1 '15 at 22:40
Can you set a~/.inputrc
when using clink? (and do you know whether it can be used Console or anything?)
– Mike H-R
Apr 20 '15 at 17:39
Apparently, see the doc github.com/mridgers/clink/blob/master/docs/clink.md.
– Baris Demiray
Dec 18 '15 at 9:29
... except aliases.clink
hatesdoskey
; forget all of your years-long and carefully-assigned aliases. that's why i stopped to use it. though i miss all the features.
– w17t
Jul 3 '17 at 17:31
|
show 1 more comment
Not natively but check out: http://mridgers.github.io/clink/ , makes cmd.exe much more productive. Quoting features from the project page:
Powerful Bash-like line editing from GNU's Readline library.
Superior path completion (TAB).
Paste from clipboard (Ctrl-V).
Support for the completion of executables/commands, and environment variables.
Undo/Redo (Ctrl-_ or Ctrl-X, Ctrl-U)
Improved command line history.
Persists across sessions.
Searchable (Ctrl-R and Ctrl-S).
History expansion (e.g. !!, !<string>, and !$).
Scriptable completion using Lua.
3
clink solved everything
– Still.Tony
Jan 20 '15 at 16:27
5
Any plans to include it by default in Windows? :D
– Jaime Hablutzel
Mar 1 '15 at 22:40
Can you set a~/.inputrc
when using clink? (and do you know whether it can be used Console or anything?)
– Mike H-R
Apr 20 '15 at 17:39
Apparently, see the doc github.com/mridgers/clink/blob/master/docs/clink.md.
– Baris Demiray
Dec 18 '15 at 9:29
... except aliases.clink
hatesdoskey
; forget all of your years-long and carefully-assigned aliases. that's why i stopped to use it. though i miss all the features.
– w17t
Jul 3 '17 at 17:31
|
show 1 more comment
Not natively but check out: http://mridgers.github.io/clink/ , makes cmd.exe much more productive. Quoting features from the project page:
Powerful Bash-like line editing from GNU's Readline library.
Superior path completion (TAB).
Paste from clipboard (Ctrl-V).
Support for the completion of executables/commands, and environment variables.
Undo/Redo (Ctrl-_ or Ctrl-X, Ctrl-U)
Improved command line history.
Persists across sessions.
Searchable (Ctrl-R and Ctrl-S).
History expansion (e.g. !!, !<string>, and !$).
Scriptable completion using Lua.
Not natively but check out: http://mridgers.github.io/clink/ , makes cmd.exe much more productive. Quoting features from the project page:
Powerful Bash-like line editing from GNU's Readline library.
Superior path completion (TAB).
Paste from clipboard (Ctrl-V).
Support for the completion of executables/commands, and environment variables.
Undo/Redo (Ctrl-_ or Ctrl-X, Ctrl-U)
Improved command line history.
Persists across sessions.
Searchable (Ctrl-R and Ctrl-S).
History expansion (e.g. !!, !<string>, and !$).
Scriptable completion using Lua.
edited Jun 14 '14 at 21:47
answered Mar 13 '13 at 8:24
Robert BakRobert Bak
758157
758157
3
clink solved everything
– Still.Tony
Jan 20 '15 at 16:27
5
Any plans to include it by default in Windows? :D
– Jaime Hablutzel
Mar 1 '15 at 22:40
Can you set a~/.inputrc
when using clink? (and do you know whether it can be used Console or anything?)
– Mike H-R
Apr 20 '15 at 17:39
Apparently, see the doc github.com/mridgers/clink/blob/master/docs/clink.md.
– Baris Demiray
Dec 18 '15 at 9:29
... except aliases.clink
hatesdoskey
; forget all of your years-long and carefully-assigned aliases. that's why i stopped to use it. though i miss all the features.
– w17t
Jul 3 '17 at 17:31
|
show 1 more comment
3
clink solved everything
– Still.Tony
Jan 20 '15 at 16:27
5
Any plans to include it by default in Windows? :D
– Jaime Hablutzel
Mar 1 '15 at 22:40
Can you set a~/.inputrc
when using clink? (and do you know whether it can be used Console or anything?)
– Mike H-R
Apr 20 '15 at 17:39
Apparently, see the doc github.com/mridgers/clink/blob/master/docs/clink.md.
– Baris Demiray
Dec 18 '15 at 9:29
... except aliases.clink
hatesdoskey
; forget all of your years-long and carefully-assigned aliases. that's why i stopped to use it. though i miss all the features.
– w17t
Jul 3 '17 at 17:31
3
3
clink solved everything
– Still.Tony
Jan 20 '15 at 16:27
clink solved everything
– Still.Tony
Jan 20 '15 at 16:27
5
5
Any plans to include it by default in Windows? :D
– Jaime Hablutzel
Mar 1 '15 at 22:40
Any plans to include it by default in Windows? :D
– Jaime Hablutzel
Mar 1 '15 at 22:40
Can you set a
~/.inputrc
when using clink? (and do you know whether it can be used Console or anything?)– Mike H-R
Apr 20 '15 at 17:39
Can you set a
~/.inputrc
when using clink? (and do you know whether it can be used Console or anything?)– Mike H-R
Apr 20 '15 at 17:39
Apparently, see the doc github.com/mridgers/clink/blob/master/docs/clink.md.
– Baris Demiray
Dec 18 '15 at 9:29
Apparently, see the doc github.com/mridgers/clink/blob/master/docs/clink.md.
– Baris Demiray
Dec 18 '15 at 9:29
... except aliases.
clink
hates doskey
; forget all of your years-long and carefully-assigned aliases. that's why i stopped to use it. though i miss all the features.– w17t
Jul 3 '17 at 17:31
... except aliases.
clink
hates doskey
; forget all of your years-long and carefully-assigned aliases. that's why i stopped to use it. though i miss all the features.– w17t
Jul 3 '17 at 17:31
|
show 1 more comment
Massimo is correct that your command prompt history does not persist across sessions. You could manually grab this before closing your prompt by typing doskey /history > history.txt
Or... you could use PowerShell as your CMD prompt, and follow this post to persist your history across sessions.
add a comment |
Massimo is correct that your command prompt history does not persist across sessions. You could manually grab this before closing your prompt by typing doskey /history > history.txt
Or... you could use PowerShell as your CMD prompt, and follow this post to persist your history across sessions.
add a comment |
Massimo is correct that your command prompt history does not persist across sessions. You could manually grab this before closing your prompt by typing doskey /history > history.txt
Or... you could use PowerShell as your CMD prompt, and follow this post to persist your history across sessions.
Massimo is correct that your command prompt history does not persist across sessions. You could manually grab this before closing your prompt by typing doskey /history > history.txt
Or... you could use PowerShell as your CMD prompt, and follow this post to persist your history across sessions.
answered Dec 17 '09 at 19:52
Sean EarpSean Earp
6,78232937
6,78232937
add a comment |
add a comment |
You can use clink.
Clink combines the native Windows shell cmd.exe with the powerful command line editing features of the GNU Readline library, which provides rich completion, history, and line-editing capabilities.
Easiest way to install clink is using chocolatey. Once you install chocolatey, you can install clink by typing
choco install clink
Starting from the next time you start cmd.exe, it should store history across sessions.
Finally decided to giveChocolatey
a shot because of this post. Installation was as easy as ofbrew
in macOS. And now I have a Bash-like command prompt in Windows!
– TranslucentCloud
Sep 23 '16 at 7:39
add a comment |
You can use clink.
Clink combines the native Windows shell cmd.exe with the powerful command line editing features of the GNU Readline library, which provides rich completion, history, and line-editing capabilities.
Easiest way to install clink is using chocolatey. Once you install chocolatey, you can install clink by typing
choco install clink
Starting from the next time you start cmd.exe, it should store history across sessions.
Finally decided to giveChocolatey
a shot because of this post. Installation was as easy as ofbrew
in macOS. And now I have a Bash-like command prompt in Windows!
– TranslucentCloud
Sep 23 '16 at 7:39
add a comment |
You can use clink.
Clink combines the native Windows shell cmd.exe with the powerful command line editing features of the GNU Readline library, which provides rich completion, history, and line-editing capabilities.
Easiest way to install clink is using chocolatey. Once you install chocolatey, you can install clink by typing
choco install clink
Starting from the next time you start cmd.exe, it should store history across sessions.
You can use clink.
Clink combines the native Windows shell cmd.exe with the powerful command line editing features of the GNU Readline library, which provides rich completion, history, and line-editing capabilities.
Easiest way to install clink is using chocolatey. Once you install chocolatey, you can install clink by typing
choco install clink
Starting from the next time you start cmd.exe, it should store history across sessions.
edited Jun 3 '18 at 16:32
Brian Burns
1034
1034
answered Aug 14 '14 at 6:37
simula67simula67
10113
10113
Finally decided to giveChocolatey
a shot because of this post. Installation was as easy as ofbrew
in macOS. And now I have a Bash-like command prompt in Windows!
– TranslucentCloud
Sep 23 '16 at 7:39
add a comment |
Finally decided to giveChocolatey
a shot because of this post. Installation was as easy as ofbrew
in macOS. And now I have a Bash-like command prompt in Windows!
– TranslucentCloud
Sep 23 '16 at 7:39
Finally decided to give
Chocolatey
a shot because of this post. Installation was as easy as of brew
in macOS. And now I have a Bash-like command prompt in Windows!– TranslucentCloud
Sep 23 '16 at 7:39
Finally decided to give
Chocolatey
a shot because of this post. Installation was as easy as of brew
in macOS. And now I have a Bash-like command prompt in Windows!– TranslucentCloud
Sep 23 '16 at 7:39
add a comment |
It is possible to save the current history to file,
`$ doskey /history > somefile.txt`
But it seems there is no way to load it back as history.
It is possible only to use a command line argument to load and execute all lines,
cmd.exe /K somefile.txt
, what can be useful to load a list of doskey macros.
This invocation could be included in a shortcut so you don't need to type it everytime; this reference has some additional info on this approach.
There is a similar question on Superuser that bring some alternatives, including clink, as suggested by @RobertBak.
Hmm, to load it back into history, wouldn't you simply need to save it to a .bat file and run it?
– Pacerier
Aug 23 '15 at 22:10
1
@Pacerier running the commands again would surely include them back in the history, but it likely would have large side-effects. Imagine that you delete some files through the shell and then recreate them outside the shell through a long and painful process. Reloading the history through your procedure would unexpectedly delete the files again.
– mMontu
Aug 24 '15 at 11:00
@Pacerier you realize "run it" does mean executing all those commands, right? It's not simply loading them into history, but actually letting them have some effects on your system.
– ADTC
Jan 7 '18 at 5:07
add a comment |
It is possible to save the current history to file,
`$ doskey /history > somefile.txt`
But it seems there is no way to load it back as history.
It is possible only to use a command line argument to load and execute all lines,
cmd.exe /K somefile.txt
, what can be useful to load a list of doskey macros.
This invocation could be included in a shortcut so you don't need to type it everytime; this reference has some additional info on this approach.
There is a similar question on Superuser that bring some alternatives, including clink, as suggested by @RobertBak.
Hmm, to load it back into history, wouldn't you simply need to save it to a .bat file and run it?
– Pacerier
Aug 23 '15 at 22:10
1
@Pacerier running the commands again would surely include them back in the history, but it likely would have large side-effects. Imagine that you delete some files through the shell and then recreate them outside the shell through a long and painful process. Reloading the history through your procedure would unexpectedly delete the files again.
– mMontu
Aug 24 '15 at 11:00
@Pacerier you realize "run it" does mean executing all those commands, right? It's not simply loading them into history, but actually letting them have some effects on your system.
– ADTC
Jan 7 '18 at 5:07
add a comment |
It is possible to save the current history to file,
`$ doskey /history > somefile.txt`
But it seems there is no way to load it back as history.
It is possible only to use a command line argument to load and execute all lines,
cmd.exe /K somefile.txt
, what can be useful to load a list of doskey macros.
This invocation could be included in a shortcut so you don't need to type it everytime; this reference has some additional info on this approach.
There is a similar question on Superuser that bring some alternatives, including clink, as suggested by @RobertBak.
It is possible to save the current history to file,
`$ doskey /history > somefile.txt`
But it seems there is no way to load it back as history.
It is possible only to use a command line argument to load and execute all lines,
cmd.exe /K somefile.txt
, what can be useful to load a list of doskey macros.
This invocation could be included in a shortcut so you don't need to type it everytime; this reference has some additional info on this approach.
There is a similar question on Superuser that bring some alternatives, including clink, as suggested by @RobertBak.
edited Mar 20 '17 at 10:16
Community♦
1
1
answered Mar 23 '13 at 13:15
mMontumMontu
16114
16114
Hmm, to load it back into history, wouldn't you simply need to save it to a .bat file and run it?
– Pacerier
Aug 23 '15 at 22:10
1
@Pacerier running the commands again would surely include them back in the history, but it likely would have large side-effects. Imagine that you delete some files through the shell and then recreate them outside the shell through a long and painful process. Reloading the history through your procedure would unexpectedly delete the files again.
– mMontu
Aug 24 '15 at 11:00
@Pacerier you realize "run it" does mean executing all those commands, right? It's not simply loading them into history, but actually letting them have some effects on your system.
– ADTC
Jan 7 '18 at 5:07
add a comment |
Hmm, to load it back into history, wouldn't you simply need to save it to a .bat file and run it?
– Pacerier
Aug 23 '15 at 22:10
1
@Pacerier running the commands again would surely include them back in the history, but it likely would have large side-effects. Imagine that you delete some files through the shell and then recreate them outside the shell through a long and painful process. Reloading the history through your procedure would unexpectedly delete the files again.
– mMontu
Aug 24 '15 at 11:00
@Pacerier you realize "run it" does mean executing all those commands, right? It's not simply loading them into history, but actually letting them have some effects on your system.
– ADTC
Jan 7 '18 at 5:07
Hmm, to load it back into history, wouldn't you simply need to save it to a .bat file and run it?
– Pacerier
Aug 23 '15 at 22:10
Hmm, to load it back into history, wouldn't you simply need to save it to a .bat file and run it?
– Pacerier
Aug 23 '15 at 22:10
1
1
@Pacerier running the commands again would surely include them back in the history, but it likely would have large side-effects. Imagine that you delete some files through the shell and then recreate them outside the shell through a long and painful process. Reloading the history through your procedure would unexpectedly delete the files again.
– mMontu
Aug 24 '15 at 11:00
@Pacerier running the commands again would surely include them back in the history, but it likely would have large side-effects. Imagine that you delete some files through the shell and then recreate them outside the shell through a long and painful process. Reloading the history through your procedure would unexpectedly delete the files again.
– mMontu
Aug 24 '15 at 11:00
@Pacerier you realize "run it" does mean executing all those commands, right? It's not simply loading them into history, but actually letting them have some effects on your system.
– ADTC
Jan 7 '18 at 5:07
@Pacerier you realize "run it" does mean executing all those commands, right? It's not simply loading them into history, but actually letting them have some effects on your system.
– ADTC
Jan 7 '18 at 5:07
add a comment |
Command History:
To enable a command history (that can be accessed using the up and
down arrow keys) just execute doskey at the command
prompt. For example, to create a command history of 100 elements:
doskey /listsize=100
ref:https://users.cs.jmu.edu/bernstdh/web/common/help/ntshell.php
3
That doesn't answer the question at all??
– Chopper3
Feb 14 '11 at 13:27
1
Not works on Windows 10.
– TranslucentCloud
Sep 23 '16 at 7:27
add a comment |
Command History:
To enable a command history (that can be accessed using the up and
down arrow keys) just execute doskey at the command
prompt. For example, to create a command history of 100 elements:
doskey /listsize=100
ref:https://users.cs.jmu.edu/bernstdh/web/common/help/ntshell.php
3
That doesn't answer the question at all??
– Chopper3
Feb 14 '11 at 13:27
1
Not works on Windows 10.
– TranslucentCloud
Sep 23 '16 at 7:27
add a comment |
Command History:
To enable a command history (that can be accessed using the up and
down arrow keys) just execute doskey at the command
prompt. For example, to create a command history of 100 elements:
doskey /listsize=100
ref:https://users.cs.jmu.edu/bernstdh/web/common/help/ntshell.php
Command History:
To enable a command history (that can be accessed using the up and
down arrow keys) just execute doskey at the command
prompt. For example, to create a command history of 100 elements:
doskey /listsize=100
ref:https://users.cs.jmu.edu/bernstdh/web/common/help/ntshell.php
answered Feb 14 '11 at 13:08
Moataz AL DawoodMoataz AL Dawood
271
271
3
That doesn't answer the question at all??
– Chopper3
Feb 14 '11 at 13:27
1
Not works on Windows 10.
– TranslucentCloud
Sep 23 '16 at 7:27
add a comment |
3
That doesn't answer the question at all??
– Chopper3
Feb 14 '11 at 13:27
1
Not works on Windows 10.
– TranslucentCloud
Sep 23 '16 at 7:27
3
3
That doesn't answer the question at all??
– Chopper3
Feb 14 '11 at 13:27
That doesn't answer the question at all??
– Chopper3
Feb 14 '11 at 13:27
1
1
Not works on Windows 10.
– TranslucentCloud
Sep 23 '16 at 7:27
Not works on Windows 10.
– TranslucentCloud
Sep 23 '16 at 7:27
add a comment |
clink is nice and the author publishes a chocolatey package on every release, however I would suggest DeepBlueCLI.
You can use https://github.com/sans-blue-team/DeepBlueCLI to set-up Windows Security Event ID 4688.
For PowerShell, DeepBlueCLI also uses module logging (PowerShell event 4013) and script block logging (4104). It does not use transcription.
The added benefit is that it logs the hash of the command line exe in AppLocker event log. Source: https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/manage/component-updates/command-line-process-auditing
Also, because this solution uses the Windows Event Log infrastructure, you can query it through WMI or PowerShell Get-EventLog
. With clink, you have to learn another tool in order to detect system- or network-wide patterns of behavior.
add a comment |
clink is nice and the author publishes a chocolatey package on every release, however I would suggest DeepBlueCLI.
You can use https://github.com/sans-blue-team/DeepBlueCLI to set-up Windows Security Event ID 4688.
For PowerShell, DeepBlueCLI also uses module logging (PowerShell event 4013) and script block logging (4104). It does not use transcription.
The added benefit is that it logs the hash of the command line exe in AppLocker event log. Source: https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/manage/component-updates/command-line-process-auditing
Also, because this solution uses the Windows Event Log infrastructure, you can query it through WMI or PowerShell Get-EventLog
. With clink, you have to learn another tool in order to detect system- or network-wide patterns of behavior.
add a comment |
clink is nice and the author publishes a chocolatey package on every release, however I would suggest DeepBlueCLI.
You can use https://github.com/sans-blue-team/DeepBlueCLI to set-up Windows Security Event ID 4688.
For PowerShell, DeepBlueCLI also uses module logging (PowerShell event 4013) and script block logging (4104). It does not use transcription.
The added benefit is that it logs the hash of the command line exe in AppLocker event log. Source: https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/manage/component-updates/command-line-process-auditing
Also, because this solution uses the Windows Event Log infrastructure, you can query it through WMI or PowerShell Get-EventLog
. With clink, you have to learn another tool in order to detect system- or network-wide patterns of behavior.
clink is nice and the author publishes a chocolatey package on every release, however I would suggest DeepBlueCLI.
You can use https://github.com/sans-blue-team/DeepBlueCLI to set-up Windows Security Event ID 4688.
For PowerShell, DeepBlueCLI also uses module logging (PowerShell event 4013) and script block logging (4104). It does not use transcription.
The added benefit is that it logs the hash of the command line exe in AppLocker event log. Source: https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/manage/component-updates/command-line-process-auditing
Also, because this solution uses the Windows Event Log infrastructure, you can query it through WMI or PowerShell Get-EventLog
. With clink, you have to learn another tool in order to detect system- or network-wide patterns of behavior.
answered yesterday
John ZabroskiJohn Zabroski
1257
1257
add a comment |
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f95404%2fis-there-a-global-persistent-cmd-history%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You can hijack the exit command to automatically save a log before exiting:
doskey exit=doskey /history ^>^> C:pathtocmdhistory.log $T exit $*
but you'll need to figure out how to execute this automatically at each command prompt session startup. PS: Make sure the path of the log file is writable.C:
is not writable for a non-admin command prompt.– ADTC
Jan 7 '18 at 5:00
@ADTC: AutoRun should handle 'each startup': superuser.com/a/302553/333316 or stackoverflow.com/a/17405182/2868801
– dave_thompson_085
Jun 3 '18 at 20:40