Thanks very much, James-especially nice to hear that for such an old post, but it is indeed proving to be a classic and one of my most popular. So I updated the top of this post to show how you would get the same history of commands entered into a PowerShell command line: In the years since this was posted (early 2011), plenty of folks have or are making the transition to Windows PowerShell (it's even becoming the default command line in some later versions of Windows). Update (Nov 2017): what about in PowerShell? (There may even be some trick to route the save directly to evernote, but I don't know that.)įor more info on fun with this command prompt doskey and related features, see these docs, which while for XP are good for Vista/Windows 7 (I couldn't find the same content in a more updated page at Microsoft.) I instead write it to a file (not worrying where it is), then open it and save that off to evernote. Just be really careful you don't forget those two brackets, or you'll lose what you have! This could be useful if you, for instance, wanted to always write the log to some file, such as in your drive root, so it would become: If you want to append to it, instead, use ">" in the command above. The named file will be created in the current directory (indicated in the command prompt window).īeware, though, that that command will overwrite any previous content in that file. So saving the displayed history to a file just involves a little more old-school DOS trickeration, whereby you can redirect the output of any command to a file, using the ">" argument, and naming the file to hold the output. Of course, from there, if the list is small enough to appear all on screen, you can just copy/paste the stuff to some file (if you know how to copy content from/to the command window), but if it scrolls off screen, that's where the command I offered is most handy (yes, I know about the "more" command to cause paging of DOS command output, but really, I'd sooner use the one command above then doing a copy, then page forward, and copy. But you will see that it has the /history argument I've used, and that lists (to the screen) all the past commands you've entered during the current command prompt session. Well, all this command-line history goodness is really driven by a command that's executed implicitly when you open a command prompt window, called DOSKEY.Īnd if you enter doskey /?, you get some available help (including reminders of the shortcut keys above, and more). But that old-school dos popup can't be edited or saved in any way. You can also "see" a list of the past commands (to choose from them, to re-execute) using f7. This solution and its meaning will be old hat to some, but it seems to be a revelation to others (judging by how many I found searching for a solution to this challenge, and not being offered any useful answer).įirst, some may know that you can recall past commands on the command prompt (to re-execute them) using the up arrow.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |