I am using Powershell 2009 on a WIN-Server 2008 R2
I have seen several suggestions on how to "redirect" the output generated by a 'cmd.exe /c', but none of the suggested solutions were successful.
I have a simple cmd
cmd.exe /c my_program.cmd $file.basename
This process creates a lot of screen output and this command is in a loop of all files in a directory.
I want to capture the output to a file "$lgfile"
I have used
Out-file -filepath $lgfile [no output]
`$lgfile 2`>>`&1 [error '&" is resereved for future use]
I would be grateful for any suggestions
Also, the reason I am using "cmd.exe /c" is because that is the only method i have been able to use successfully (my_program.cmd is calling an ORACLE compiler! and all other methods to execute this compiler did not work except as a cmd-file)