I’d like to write a program that effectively “pipes” Powershell, so that I can send commands and parse the responses in C++, without actually opening the prompt on the screen.
Any tips?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can certainly do this but you’ll need to use managed code as PowerShell’s architecture is based entirely on the CLR object model.
I’m not sure of the C++ syntax but you can start with the PowerShell class in System.Management.Automation.dll and use its static Create method to create an instance to which you can pipe data and run commands.