How to call powershell from c++

For dos commands I use system(doscommand) in c++

What can I use for powershell cmdlets in c++

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gateguardAuthor Commented:
Thanks but I'm looking for something more concrete.

Like I said, to run dos commands in c++ ... system(doscommand)

To run powershell cmdlets in c++ ... ???

QlemoBatchelor, Developer and EE Topic AdvisorCommented:
You can use the PS SDK from to build a PS host. The host then runs the PS command.
The ISE is such a host, the PS console, etc.
Building a host allows you to have full control over input, actions and output. The examples should show you how to do that. Provided you have managed C++, that is ...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gateguardAuthor Commented:
I don't see it there.

I'm working with using calling powershell from the system() command.
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Using system() for calling PS is very primitive, and cuts you out of any advanced result processing. But if you wish ... Just call
  powershell.exe -NoLogo c:\temp\script.ps1
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.