powershell
powershell copied to clipboard
Issue when running prompt
Description of the issue
I followed all of the instructions, but when I try to set the environment variable prompt, I get this error:
At line:1 char:5
+ $E[1;32;40m→ $E[1;36;40m$p$E[1;35;40m› $E[1;37;40m
+ ~
Missing ']' after array index expression.
At line:1 char:18
+ $E[1;32;40m→ $E[1;36;40m$p$E[1;35;40m› $E[1;37;40m
+ ~
Missing ']' after array index expression.
At line:1 char:44
+ $E[1;32;40m→ $E[1;36;40m$p$E[1;35;40m› $E[1;37;40m
+ ~
Missing ']' after array index expression.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingEndSquareBracket
Screenshots
Version Information
Please provide the output of this PowerShell command:
(Get-Module PSReadline).Version; (Get-Module posh-git).Version
Major Minor Build Revision
----- ----- ----- --------
2 0 0 -1
Hi @jhollender!
I believe that prompt string is intended for cmd.exe; you can use it with the prompt
command like so:
To set the prompt in PowerShell, you'll likely want to use dracula-prompt-configuration.ps1. Here's what that looks like:
hi,
I set the prompt to $E[1;32;40m→ $E[1;36;40m$p$E[1;35;40m› $E[1;37;40m
successfully, and after setting, the changes are visible.
But when I close cmd and open it again, it goes back to the previous state !
@mrfjca To persist the change, you'll want to save the string to the %PROMPT%
environment variable. This can be accomplished in cmd using setx
:
setx PROMPT "$E[1;32;40m→ $E[1;36;40m$p$E[1;35;40m› $E[1;37;40m"
@examosa The problem was fixed 👍 Thank you very much for your help 🙏.