Skip to main content

How to Use Your Command History in the Windows Command Prompt

The Windows Command Prompt has a built-in history feature, allowing you to quickly view commands you’ve run in the current session. Even better, the Command Prompt offers quite a few keyboard shortcuts and other tricks for working with your command history.

How to View Your Command History

To scroll through your command history, you can use these keyboard shortcuts:
  • Up Arrow: Recall the previous command you typed. Press the key repeatedly to walk through your command history.
  • Down Arrow: Recall the next command you typed. Press the key repeatedly to walk through your command history.
  • Page Up: Recall the first command you ran in the current Command Prompt session.
  • Page Down: Recall the most recent command you ran in the current Command Prompt session.
  • Esc: Clear the command line.
Use these F keys to interact with your command history:
  • F7: View your command history as an overlay. Use the up and down arrow keys to select a command and run it. Press Esc to close the overlay without running a command.
  • F8: Search your command history for a command matching the text on the current command line. So, if you wanted to search for a command that began with “p”, you’d type “p” on the command line and then repeatedly tap F8 to cycle through commands in your history that begin with “p”.
  • F9: Recall a command from your command history by specifying its number in the history buffer. These numbers are display in the F7 overlay window, and begin at 0. So, if you wanted to quickly re-run the first command you ran in the current session, you’d press “F9”, type “0”, and press “Enter”. The command would appear filled in at the prompt and you could press “Enter” once again to run it.
To print a list of your command history in the terminal, run the following command:
doskey /history
You’ll see the commands you’ve typed in your current session. This is the same list you’ll see if you press F7.

How to Copy Your Previous Command

The previous command you typed is known as the “template”. There are a variety of shortcuts for quickly copying part of the previous command you ran.
  • F1: Copy one character at a time from the the previous command you typed. Press the F1 key repeatedly to type the command you previously typed, character by character.
  • F2: Copy part of the command you previously typed. You’ll be prompted to enter a character. The system will search forward in the previous command you typed and automatically copy the text up to, but not including, that character. For example, if the last command you ran was “ping google.com”, you could press “F2”, type “o”, press “Enter”, and “ping g” would appear at the prompt.
  • F3: Copy part of the command you previously typed. The system will start from the current character position and automatically copy the remainder of the text from that position on the previous line. For example, let’s say the last command you typed was “ping -4 google.com”. You could type “ping -6”, press “F3″, and the system would automatically fill in ” google.com”, making the current line “ping -6 google.com”.

How to Clear the Command History

Unlike Linux’s bash shell, the Command Prompt doesn’t remember commands between sessions. To erase the history of any commands you typed, just close the Command Prompt window.
You can tell the Command Prompt to not remember any commands you’ve typed in the current session by setting the history size to 0 with the doskey command:
doskey /listsize=0
You won’t be able to use the arrow keys, F7 key, or doskey /history command to see any commands you’ve typed after setting the list size to 0. This change also only takes effect for the current Command Prompt window, so the Command Prompt window will remember history as normal the next time you close and reopen it.
You can use the cls (clear screen) command to clear your Command Prompt window, erasing all history of the commands you typed without closing the window:
cls

How to Save Your Command History

If you ever need to save a history of the commands you typed in a Command Prompt window, you can do it by running the doskey /history command and routing its output to a text file. (You could also just run the doskey /history command and copy/paste text to another application, of course.)
For example, the following command will save a copy of your current Command Prompt window’s command history to the C:\Users\name\Desktop\commands.txt file on your system.
doskey /history > C:\Users\name\Desktop\commands.txt
The character redirects the output of the command to the file you specify.

Comments

Popular posts from this blog

sxhkd volume andbrightness config for dwm on void

xbps-install  sxhkd ------------ mkdir .config/sxhkd cd .config/sxhkd nano/vim sxhkdrc -------------------------------- XF86AudioRaiseVolume         amixer -c 1 -- sset Master 2db+ XF86AudioLowerVolume         amixer -c 1 -- sset Master 2db- XF86AudioMute         amixer -c 1 -- sset Master toggle alt + shift + Escape         pkill -USR1 -x sxhkd XF86MonBrightnessUp          xbacklight -inc 20 XF86MonBrightnessDown          xbacklight -dec 20 ------------------------------------------------------------- amixer -c card_no -- sset Interface volume run alsamixer to find card no and interface names xbps-install -S git git clone https://git.suckless.org/dwm xbps-install -S base-devel libX11-devel libXft-devel libXinerama-devel  vim config.mk # FREETYPEINC = ${X11INC}/freetype2 #comment for non-bsd make clean install   cp config.def.h config.h vim config.h xbps-install -S font-symbola #for emoji on statusbar support     void audio config xbps-i

Hidden Wiki

Welcome to The Hidden Wiki New hidden wiki url 2015 http://zqktlwi4fecvo6ri.onion Add it to bookmarks and spread it!!! Editor's picks Bored? Pick a random page from the article index and replace one of these slots with it. The Matrix - Very nice to read. How to Exit the Matrix - Learn how to Protect yourself and your rights, online and off. Verifying PGP signatures - A short and simple how-to guide. In Praise Of Hawala - Anonymous informal value transfer system. Volunteer Here are five different things that you can help us out with. Plunder other hidden service lists for links and place them here! File the SnapBBSIndex links wherever they go. Set external links to HTTPS where available, good certificate, and same content. Care to start recording onionland's history? Check out Onionland's Museum Perform Dead Services Duties. Introduction Points Ahmia.fi - Clearnet search engine for Tor Hidden Services (allows you

download office 2021 and activate

get office from here  https://tb.rg-adguard.net/public.php open powershell as admin (win+x and a ) type cmd  goto insall dir 1.         cd /d %ProgramFiles(x86)%\Microsoft Office\Office16 2.           cd /d %ProgramFiles%\Microsoft Office\Office16 try 1 or 2 depending on installation  install volume license  for /f %x in ('dir /b ..\root\Licenses16\ProPlus2021VL_KMS*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%x" activate using kms cscript ospp.vbs /setprt:1688 cscript ospp.vbs /unpkey:6F7TH >nul cscript ospp.vbs /inpkey:FXYTK-NJJ8C-GB6DW-3DYQT-6F7TH cscript ospp.vbs /sethst:s8.uk.to cscript ospp.vbs /act Automatic script (windefender may block it) ------------------------------------------------------------------------------------------------------------------- @echo off title Activate Microsoft Office 2021 (ALL versions) for FREE - MSGuides.com&cls&echo =====================================================================================&