However, if I were to run the .bat file without the C++ program executing it the PowerShell script works, but when I let the C++ console application run the .bat file the PowerShell script gives me this error:
"cannot be loaded because running scripts is disabled on this system."
I do run this as administrator and have ran Set-ExecutionPolicy RemoteSigned.
It is weird that this works when I just run the .bat file myself but doesnt when the C++ program runs the .bat file.
I am not sure if this is to do with C++ and the way I execute the bat file or if it is totally different and something with PowerShell.
PowerShell is an optional component of Windows and may not even be installed on some systems, is there a reason you need to use it? If you can write C++ you shouldn't need to use batch scripts of any kind - that's just limiting yourself to a more restrictive language for no reason.
I am making a program which removes the default apps in Windows 10 like People, Mail, News etc... Because some of them cannot be removed by just clicking uninstall. My program also did other things in Windows 10, but as there is a powershell command to remove most of the Windows 10 apps I thought I could make a batch file which would run the script. I did this because I do not know what Get-AppxPackage *xboxapp* | Remove-AppxPackage does for example, yes I could do this in C++ but I am not sure what that code does completely as in what and where it deletes files etc...