0
  1. I am calling child process from a process in Powershell.
  2. The child process will not end, it will be running continuously in the background.

  3. I need the logs entered by the child process continuously.

  4. process.standardoutput.rradtoend() will enter the logs into file when the child process ends.

But i need the logs continuously.

Please help me in this regard.

Raj
  • 179
  • 2
  • 5

1 Answers1

0

You can redirect the log to files as below:

start-process your_executable -ArgumentList "your arguments" -RedirectStandardOutput the_path_you_want_to_put_your_log -RedirectStandardError the_path_to_put_error_log

the logs of the child process will be written to the log files continuously, you can open the files to check them from time to time.

Edit

And I think Unix tail equivalent command in windows Powershell will do you more help, which tell you how to monitor the log file in real time, like use the Get-FileTail Cmdlet from PowerShell Community Extensions

Community
  • 1
  • 1
poiu2000
  • 960
  • 2
  • 14
  • 30