Home > other >  Any command to use in PowerShell to copy few lines from Console?
Any command to use in PowerShell to copy few lines from Console?

Time:01-15

in my powershell script a lot of items are getting printed in the console. I want to copy them and validate a data is present or not. Any way I can do it?

I am yet to get any solution for this. thank you in advance

CodePudding user response:

if your case is to validate your logs I suggest saving the logs into a file and then validating them and don't use the console for that purpose. if you still want to copy them from the console try this: Copy text from a Windows CMD window to clipboard

CodePudding user response:

One Way to record everything thats going on with your Script is Powershell Transcript

Or you can just Copy the Output from your Console to a Text file in Notepad or something like that...

But to be honest I don't quite understand what you are trying to achieve with that, wouldn't be the goal with a script that you don't have to check something like that?

My suggestion would be that you look for a way to validate anything you need within your Script, and maybe implement some sort of Logging to have the Option to review it when something has gone wrong...

  • Related