Change from VS Debug Console to Powershell for running .exe code?

Willie-Ray Terry 21 Reputation points
2022-05-11T12:37:47.893+00:00

Is there any way to change the 'run' behavior so that my code outputs with powershell as the terminal, not the built in VS debug console?
For practicality, it makes no difference. I would just like to see my 'hello worlds' output to Powershell instead of the built in debug console.

Windows for business Windows Client for IT Pros Devices and deployment Other
Developer technologies Visual Studio Debugging
Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

Accepted answer
  1. Tianyu Sun-MSFT 34,436 Reputation points Microsoft External Staff
    2022-05-12T07:06:19.66+00:00

    Hi @Willie-Ray Terry ,

    Welcome to Microsoft Q&A forum.

    You can try to set your project and let it start external program like PowerShell to run your project(.exe file).

    Right-click your project node in VS Solution Explorer > Properties > Debug > Start action > select Start external program and Browse to select powershell.exe( C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe ) > Start options > Command line arguments: > type your project to run for example XXXX\XXXXXX\MyApplication.exe.

    I guess you may be working on a Console application, actually, what you are seeing is that your Console Application is running, not calling Console as the terminal to run, it is a Console application itself.

    BTW, Visual Studio Debugging features may not work if you call PowerShell to run your project.

    Have a great day.

    Best Regards,
    Tianyu

    • If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

1 additional answer

Sort by: Most helpful
  1. Limitless Technology 39,916 Reputation points
    2022-05-12T15:30:43.053+00:00

    Hello @Willie-Ray Terry

    To change the Debug output window from prompt to Powershell, please follow the next:

    1 Press Ctrl+Shift+P to show all commands.
    2 Type profile in the displayed text box to filter the list.
    3 Select Terminal: Select Default Profile.
    4 You will be prompted to Select your preferred terminal shell, you can change this later in your settings or follow the same process as we do now
    5 Select Command Prompt (cmd.exe)
    6 Click the Delete Icon in the shell pane to remove the existing terminal.
    7 Press Ctrl+` (or View > Terminal in menu) to open a new terminal pane.

    Hope this helps with your query,

    ------------

    --If the reply is helpful, please Upvote and Accept as answer--

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.