I have no idea if this is even a programming question, or something that is configured through my OS. But how would I get it so my console application uses Powershell instead of cmd? I know I can open Powershell and run the program from there, but even then, calls such as system("Get-Childitem") fail.
I'm using Visual C++ by the way, if that matters. But if it's a compiler specific thing, then I would also like to know how to do it with GCC.
Look into the environment variable COMSPEC, which on Windows, and DOS 1.1 before that, controls which shell is utilized for launching programs that need a shell.
SET COMSPEC=%path_to_powershell%
You can do the same within your C++ program by calling the setenv C runtime call;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With