I need to run a powershell command from C++ application. This powershell command need to redirect powershell script output to a file using UFT16 encoding.
I run the following command, but out.txt is not in UFT16, but seems in UTF8.
powershell.exe -File myps.ps1 > out.txt
I also tried the following. But the error is "'out-file' is not recognized as an internal or external command operable program or batch file."
powershell.exe -File myps.ps1 | out-file "enctest.txt" -encoding unicode
Maybe should use -Command? How to do this?