DEV Community

Sebastian
Sebastian

Posted on

How to almost run your Console Apps in the new terminal from Visual Studio2019

If you like me love what microsoft has done with the new terminal you might be wondering when and how can i run this as the default terminal in windows, and how i can start my console apps through this beauty.

Well the answer to question number one is easy, just relearn to write wt instead of the classic cmd
Note that this will just launch the terminal, meaning it will most likely start in your %USERPROFILE% folder

Thankfully you can start from any location with the -d flag
wt -d <Path>
which means that we can start from the current directory with
wt -d .

What about the "Open command prompt here" right-click menu?

While this can be achieved through editing the registry yourself the feature is merged and should be release in the next public release, and is already available in the preview build.
Heres the roadmap for the terminal:
https://github.com/microsoft/terminal/blob/master/doc/terminal-v2-roadmap.md
And here is the PR for that specific feature:
https://github.com/microsoft/terminal/pull/6100

So what does that mean for visual studio?

Well what you can do is change your executable from your project settings to instead start the terminal and pass your application as arguments.
To pass commands directly to the terminal is done with the flags
wt cmd /c <your command>

So what can be done is changing your Project settings under the Debug tab to Launch: Executable as opposed to Project.
And then pass wt as your executable
and for arguments -d . cmd /c <YourExecutable.exe>

Sadly this breaks debugging and launches two terminal windows, one to run your custom command and one with the new terminal.

Latest comments (0)