Cmd.exe

How to Save the Command Prompt’s Output to a Text File in Windows

Saving the output of a Windows Command Prompt command is a great way to get a nice neat copy to share with support staff, analyze longer outputs using your favorite text editor, or otherwise interact with the output with more flexibility than staying in the command window allows for.

To redirect the output of a command to a text file instead of printing it to the screen in the command window, we simply need to execute the command and append it with the “>” angle bracket symbol—called, appropriately enough, a redirection.

If, for example, you wanted to save the output of the DIR function to a text file instead of scrolling for page after page on your screen in the command window, you would execute the command

DIR > some-descriptive-filename.txt

like so,…

What Is hiberfil.sys and How Do I Delete It?

You’re likely reading this because you noticed a gigantic hiberfil.sys file sitting on your system drive and you’re wondering if you can get rid of it to free up some space. Here’s what that file is and how you can delete it if you want to.

What Is the hiberfil.sys File?

Depending on the version of Windows you’re using, you have several options for conserving power when you’re not using your PC. Obviously, you can just shut it down. But, you can also send it into a sleep or hibernate mode, where it uses dramatically less power but is still available quickly when you need it. Sleep uses just enough power to maintain the information in your PC’s memory. Hibernate conserves even more power by writing the information in memory out to the hard drive and essentially shutting down—the benefit being that bringing your PC back up is much quicker than bringing it up from a fully off state. That’s where the hiberfil.sys file comes in—Windows writes the information in memory to that file.

While we recommend using sleep or hibernation instead of shutting down your PC in most cases, we understand that many people simply prefer shutting down. In that case, disabling hibernate mode on your PC will allow you…

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…

Is It Possible to Clear the History in the Windows Command Prompt?

If you use the Windows command prompt often throughout your work day, you may want or need to periodically clear the command history. Is it possible to do so while the command prompt is still open? Today’s SuperUser Q&A post has the answer to a curious reader’s question.

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

SuperUser reader Alexander B. wants to know if it is possible to clear the history in the Windows command prompt:

When using the Windows command…