question

WillieRayTerry-8206 avatar image
0 Votes"
WillieRayTerry-8206 asked WillieRayTerry-8206 commented

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

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-server-powershellvs-debuggingwindows-hardware-code-ndis
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

TianyuSun-MSFT avatar image
0 Votes"
TianyuSun-MSFT answered WillieRayTerry-8206 commented

Hi @WillieRayTerry-8206 ,

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
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks. I've decided to keep everything as is based on this response.

0 Votes 0 ·
LimitlessTechnology-2700 avatar image
0 Votes"
LimitlessTechnology-2700 answered

Hello @WillieRayTerry-8206

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--

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.