MadCat
MadCat

Reputation: 119

VSCode Terminal - Changing current working directory's color

title basically says it all.

Currently, the working directory displayed in the terminal (e.g. PS C:\Users\User\Python\Projects>) is colored white, but I'd like to assign a different color. The new color should be exclusive only for that path, and not affect the entirety of the terminals fontcolor, so just changig terminal.foreground in the workbench.colorCustomizations ain't gonna cut it.

If it's possible to change that, please help me, otherwise inform me of the impossibility of the task at hand, so that I can stop wasting my time in the google search bar.

Upvotes: 1

Views: 567

Answers (1)

adam
adam

Reputation: 105

Open Powershell and type the follwoing and press Enter

New-Item -Type File -Path $PROFILE -Force 

Go to Documents > WindowsPowerShell folder and open file called Microsoft.PowerShell_profile.ps1 with Notepad.

Copy the following command and paste it in the file

function prompt {
    $color = 'Magenta'
    Write-Host ("" + $(Get-Location) +">") -NoNewLine `
     -ForegroundColor $Color
    return " "
}

You can change Magenta with Red, Yellow, Cyan, etc...

Save the file and then Run PowerShell as Administrator and type, run the following in order:

Set-ExecutionPolicy

RemoteSigned

yes

In case you changed your mind and want to restore default options, just open PowerShell as Administrator and type,run the following in order

Set-ExecutionPolicy

Restricted

yes

and then Remove the PowerShell Folder in Documents

I have also created a Video to customize the path of Powershell, it contains similar steps in case you want step by step https://www.youtube.com/watch?v=hlOzVvY9R-g

Upvotes: 1

Related Questions