5

In Windows command prompt cls clears the screen.

Can I get back the data after it's cleared?

cshu
  • 175
  • 1
  • 5

2 Answers2

5

cls is an internal command and works by clearing the buffer, which it was fixed 25 or 50 lines in case of the first DOS and Windows, respectively. So when you clean it you cannot have it back.

Different situation is if you are logging all the output of the shell in a file... take some hints from this answer or from the use of tee or other methods.
There is a number of programs that are able to log input and output of the shell.


With a powershell you can start the logging simply with

C:\>Start-Transcript

Transcript started, output file is C:\Users\administrator.ESPNET\Documents\PowerShell_transcript.20150710113555.txt

then you can stop it with

C:\>Stop-Transcript

Reference

The session is simply recorded to a text file that contains all of the input commands and the output that is displayed in the Exchange Management Shell window.

Hastur
  • 18,764
  • 9
  • 52
  • 95
2

Potentially by re-running the same command / string of commands again to get the same output?

  • Browse the last commands used by pressing up/down

  • If you just wish to read the last commands press F7 with the command prompt as the active window and it should pop up a list of the last 10 commands that ran (this is on Windows 10).

Glaic
  • 21
  • 1
  • Just a note that using F7 to display a command history (not just last 10) also works on Windows 8. – doldt Sep 22 '16 at 09:19