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.

Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
931 questions
Windows Hardware Performance
Windows Hardware Performance
Windows: A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.Hardware Performance: Delivering / providing hardware or hardware systems or adjusting / adapting hardware or hardware systems.
1,538 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,346 questions
0 comments No comments
{count} votes

Accepted answer
  1. Tianyu Sun-MSFT 27,031 Reputation points Microsoft Vendor
    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,331 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