Opening console applications in powershell Opening console applications in powershell powershell powershell

Opening console applications in powershell


I think you're mixing up the NT console subsystem (an app framework offerring common services) with cmd.exe (an application consuming those services.) When visuals studio runs a console application, it's not actually running CMD. CMD is a console application itself, no different than the app you are trying to debug, therefore running your application "in powershell" is equally as mistaken a concept.

If you mean trying to run it in PowerShell ISE, this is impossible. ISE is a Windows Application (NT GUI subsystem), which is an entirely different subsystem than that of the console.

-Oisin


You can try this.

  1. Go to properties of your console project.
  2. In Debug tab select Start external program and enter path to powershell.exe (C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe)
  3. Enter ".\YourApp.exe" into Command line arguments

This starts your app in powershell. However it breaks a lot of things (like debugging, ...)


In Visual Studio goto Tools > External Tools...

In this window you can change the Title to Powershell. Set the Powershell Startup to execute and the check the output window box and it will dump all the output that would typically goto cmd into Powershell.

This link will explain it a little bit more for you.