How to hide terminal path while using PowerShell?

CharlieLor 551 Reputation points
2023-04-11T14:55:05.7466667+00:00

How do I hide the terminal path in Visual Studio under Windows Server? Currently it's showing this: PS C:\Users\user-name> I want to only show PS instead of the whole path there. Thank you.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,888 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,463 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Ian Xue (Shanghai Wicresoft Co., Ltd.) 34,271 Reputation points Microsoft Vendor
    2023-04-12T03:20:23.9233333+00:00

    Hi, You can just add a prompt function to your PowerShell profile $HOME\Documents\WindowsPowerShell\Profile.ps1

    function prompt{"PS >"}
    

    Best Regards,

    Ian Xue

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    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.

    2 people found this answer helpful.
    0 comments No comments

  2. CharlieLor 551 Reputation points
    2023-04-12T15:27:21.3066667+00:00

    Thank you for the response. Is there a way to add this setting to my User > settings.json file? If so, what's the correct syntax? Thanks!

    0 comments No comments