'How to display path in new line after displaying output in Visual Studio code?

Here

The output that is displayed and the path of folder has no gap (the output javed and path PS... Both are attached. I want to display output "Maha Javed" to appear at one line and then PS.... To display on new line), how can I make the path to display on new line in terminal powershell in visual studio code?



Solution 1:[1]

It sounds like your prompt may be broken, the Prompt function is used in Powershell to generate the prompt.

In my case running this in VSC yeilds:

( Get-Command Prompt).ScriptBlock

"PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) ";
# .Link
# https://go.microsoft.com/fwlink/?LinkID=225750
# .ExternalHelp System.Management.Automation.dll-help.xml

Now as the other commentors have noted this behaviour is not usual. But if your prompt script is different from the above for some reason you can reset it or at least see what it is and indeed change it to what you please.

See https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_prompts?view=powershell-7 for a full explanation of this.

Solution 2:[2]

( Get-Command Prompt).ScriptBlock

same problem what to do in ubuntu 20 How to display path in new line after displaying output in vs code in linux distro

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 cyborg
Solution 2 Kll