'Powershell reroute output files of exe into directory
We have an internal process set up in Powershell which runs an exe file internal.exe which creates a lot log files in an absolute path "C:\This\is\absolute" which contains all the log files of the past 30 days. "C:\This\is\absolute" contains also log files from other applications and while internal.exe runs and creates log files in "C:\This\is\absolute" another application might create a log file there as well. Now we need to send the log files created by internal.exe and for this they have to be moved to another folder "C:\Move\here" after having been created.
The process is currently simply set up as
Start-Process -FilePath "internal.exe"
I was looking for something like
Get-Outputfiles (Start-Process -FilePath "internal.exe") | foreach {Move-Item -Path $_ -Destination "C:\Move\here"}
but I found only ways to write output to files, e.g., via Out-File. Is there a way to get something like the Get-Outputfiles which lists the paths of output files from a process?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
