Application created in C++, run in Powershell does not print output

Unanswered Application created in C++, run in Powershell does not print output

  • Thursday, February 23, 2012 7:38 AM
     
     

    Hello,

    I have windows application in C++.

    At the end which prints

    printf_s("Application normally closed with return code: %d", ExitCode);

    When run this application on command promp by calling executable,

    application prints the message succssfully on command prompt.

    But if tried calling exeutable on Powershell.

    The application executes perfectly but at the end does not print message on console.

    Is there any seting do I need to do in powershell for executing application?

    or is there any setting I need to do in my application to run it in powershell?

All Replies

  • Thursday, February 23, 2012 11:35 AM
     
     

    If you have a native commandlin application an commanline window should open and display al contents there.

    From what I know you must use managed code to use the enhanced possibilities of the power shell.

    See here:

    http://stackoverflow.com/questions/4611415/access-powershell-via-visual-c-api

  • Friday, February 24, 2012 5:45 AM
     
     

    The same C++ application showing output on my friends powershell window but not showing on my powershell screen.

    Is there any setting that I need to do in powershell to view output?

  • Tuesday, February 28, 2012 5:45 AM
    Moderator
     
     

    Hi Ashish_S,

    I have been watching this issue for a while now. I suggest you try ouputing the contents to other places, such as a text document or a console window, instead of the powershell window.

    Best regards,
    Helen Zhao


    Helen Zhao [MSFT]
    MSDN Community Support | Feedback to us

  • Tuesday, February 28, 2012 9:39 PM
     
     

    The same C++ application showing output on my friends powershell window but not showing on my powershell screen.

    Is there any setting that I need to do in powershell to view output?

    Does it use "plain vanilla" stdio or something else like WriteConsole?

    -- pa

  • Thursday, March 29, 2012 9:11 AM
     
     
    we are using WriteConsole
  • Thursday, March 29, 2012 9:12 AM
     
     
    The problem is occuring only on Windows 2008 R2 Server 64bit machine