CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2013

    Send commands or variables.

    Hi Fellows,

    I'm traying to create an executable with C or C++ that send a command with the function system, but it waits for a command or key.

    Example :

    I send this:

    C:\runas /noprofile user:administrator notepad.exe

    But it waits for password.

    Please type the password :

    So my question is how can I make to send the password or that my program detect that prompt.


  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004

    Re: Send commands or variables.

    Use CreateProcessWithLogonW to run the runas command.

    You'll programmatically enter the user/password as parameters to CreateProcessWithLogonW and it will execute runas under that account without prompting you within the runas command.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.