1

Consider Example as: C:\Users>help

Output: We get list of commands for working with CMD

Expected: I want once this command is run - whatever is present in cmd console, I want to paste in some notepad file through some command (Not by Marking and Pasting).

4
  • Why do you need to do it? Commented Mar 12, 2017 at 0:59
  • @Bill_Stewart - I have a tool which generates OTP. And I need to capture that OTP in some file. Redirection operator does not support with that tool. Commented Mar 18, 2017 at 14:18
  • @Bill_Stewart as a log of what has been done in cmd. 4k people want to do it. Commented Oct 14, 2024 at 19:10
  • Your OTP program possibly writes to standard error (rather than standard output). If that's the case, then use 2> to redirect that. Commented Oct 15, 2024 at 18:34

3 Answers 3

2

For PowerShell, you can use Start-Transcript, it will save the all console output to a file.

From the documentation:

The Start-Transcript cmdlet creates a record of all or part of a Windows PowerShell session to a text file. The transcript includes all command that the user types and all output that appears on the console.

Reference: https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.host/start-transcript

Sign up to request clarification or add additional context in comments.

Comments

0

Try this

C:\Users>help > help.txt 

results will be in help.txt

6 Comments

I am lookingn where, once i ran help and gets output. Then whatever is present in console - I want to paste in notepad file through command.
@Poc can you explain why the above solution is not working for you? you can open help.txt with notepad and it will contain the result of the help ....
the command help > help.txt will work. But here you are trying to run help command and simultaneously pasting the output to help.txt.
i want that- once i run my command and gets output shown in console. Is there any command which can paste entire visible output in console to some file .
@Poc I don't think that what you are looking for exists. However I could suggest a workaround. Enable telnet server. telnet to self. use telnet -f filename.txt . Then what ever you do in console will be saved into file...
|
-1

You can also use ctrl + A to select all, ctrl + C to copy, then use ctrl + v to paste into notepad.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.