powershell icon indicating copy to clipboard operation
powershell copied to clipboard

Issue when running prompt

Open jhollender opened this issue 2 years ago • 4 comments

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 2022-06-29 19_54_55-Windows PowerShell

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

jhollender avatar Jun 30 '22 02:06 jhollender

Hi @jhollender!

I believe that prompt string is intended for cmd.exe; you can use it with the prompt command like so:

image

To set the prompt in PowerShell, you'll likely want to use dracula-prompt-configuration.ps1. Here's what that looks like:

image

examosa avatar Jul 29 '22 16:07 examosa

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. Screenshot 2022-08-29 213832

But when I close cmd and open it again, it goes back to the previous state ! Screenshot 2022-08-29 213927

mrfjca avatar Aug 29 '22 17:08 mrfjca

@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 avatar Aug 29 '22 17:08 examosa

@examosa The problem was fixed 👍 Thank you very much for your help 🙏.

mrfjca avatar Aug 29 '22 17:08 mrfjca