Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows Terminal - PowerShell customization via oh-my-posh/posh-git Set-Theme error? #9237

Closed
nihaltowfiq opened this issue Feb 21, 2021 · 29 comments
Labels
Issue-Docs It's a documentation issue that really should be on MicrosoftDocs/Console-Docs Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Resolution-External For issues that are outside this codebase

Comments

@nihaltowfiq
Copy link

Windows Terminal - PowerShell customization via oh-my-posh/posh-git Set-Theme error?

I follow the exact tutorial of Microsoft link: Link Here video link: Video Link Here

I have installed Posh-Git and Oh-My-Posh: via this code -
Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser

I have installed PSReadLine: via this code -
Install-Module -Name PSReadLine -Scope CurrentUser -Force -SkipPublisherCheck

I am also created Microsoft.PowerShell_profile.ps1 file by typing- code $PROFILE, in my PowerShell profile and copy/paste this code:
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme Paradox

But I get this error:

Set-Theme Paradox
The term 'Set-Theme' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

ScreenShot: Screenshot of error

ssss

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Feb 21, 2021
@DHowett
Copy link
Member

DHowett commented Feb 22, 2021

Thanks for letting us know. There's a bunch of discussion over in our documentation repository about this, so I'll have to redirect you there. Cheers!

@DHowett DHowett closed this as completed Feb 22, 2021
@DHowett DHowett added Issue-Docs It's a documentation issue that really should be on MicrosoftDocs/Console-Docs Resolution-External For issues that are outside this codebase labels Feb 22, 2021
@JustDre
Copy link

JustDre commented Mar 14, 2021

It seems the "Set-Theme" cmdlet was renamed to "Set-PoshPrompt".

@wys-wys
Copy link

wys-wys commented Apr 1, 2021

It seems the "Set-Theme" cmdlet was renamed to "Set-PoshPrompt".
thank you,i have solved it

@glaucia86
Copy link
Member

Hi! Any updates about it? I've been received the same message error!

image

@nihaltowfiq
Copy link
Author

Hi! Any updates about it? I've been received the same message error!

image

please, read the previous comment >>> It seems the "Set-Theme" cmdlet was renamed to "Set-PoshPrompt".

@codewithiulian
Copy link

For anyone still struggliong with this issue use Set-PoshPrompt, as JustDre said above, followed by the -Theme option. Here is an example:
Set-PoshPrompt -Theme pixelrobots
I am using posh-git version 1.0.0 and oh-my-posh version 3.157.2.
Hope this helps

TeamDman referenced this issue in MicrosoftDocs/terminal Jul 10, 2021
Oh-my-posh has updated to version 3, so adding a note to designate version 2 on this uninstall until we can return to this tutorial and update to version 3. In the meantime, there are other tutorials available on the web that walkthrough how to install OMP v3 and set it up with git status, etc.
@sajadshafi
Copy link

It seems the "Set-Theme" cmdlet was renamed to "Set-PoshPrompt".

Yeah it did work fine. Change "Set-Theme" to "Set-PoshPrompt"

@Wineric
Copy link

Wineric commented Aug 3, 2021

I installed the latest version of oh-my-posh i.e. if you follow the guide on microsoft don't use the required version but let it install the latest.

@GeoBrodas
Copy link

GeoBrodas commented Aug 12, 2021

Hey I'm getting this error, does anyone have a fix?

I followed the tutorial in the Terminal docs here

image

@jiyulei
Copy link

jiyulei commented Aug 12, 2021

Hey I'm getting this error, does anyone have a fix?

I followed the tutorial in the Terminal docs here

image

Hey, I had the same issue. I did Update_Module in Powershell, it will update the oh-my-posh module to lastest version (actually all modules, you can also update oh-my-posh only). Then i got no errors. Hope this works for you too.

@GeoBrodas
Copy link

Hey, thanks for the tip. It's working now!

@SubwayMan
Copy link

I was having the same issue as the users above me. I followed the tutorial as well. I believe this error occurs because a command given by the documentation installs an older version, see:
Install-Module oh-my-posh -Scope CurrentUser -RequiredVersion 2.0.412
This conflicts with the given PowerShell configuration, as it is intended for newer versions of oh-my-posh. The version installed by the tutorial command works if you switch from Set-PoshPrompt back to Set-Theme, although I would suggest following the advice given above - although a small correction is required, since the command is Update-Module instead of Update_Module.

@abiriadev
Copy link

I've tried all the above things,
but still some error.

> Set-PoshPrompt -Theme Paradox

& : The term 'C:\Users\<username>\OneDrive\문서\WindowsPowerShell\Modules\oh-my-posh\3.133.1\bin\posh-windows-amd64.exe'
is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name,
or if a path was included, verify that the path is correct and try again.
At line:1 char:23
+ ... ression (@(&"C:\Users\<username>\OneDrive\문서\WindowsPowerShell\Modules ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\<username>\...ndows-amd64.exe:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Invoke-Expression : Cannot bind argument to parameter 'Command' because it is an empty string.
At line:1 char:19
+ ... -Expression (@(&"C:\Users\<username>\OneDrive\문서\WindowsPowerShell\Mod ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Invoke-Expression], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.Invo
   keExpressionCommand

I don't know where the path C:\Users\oro36\OneDrive\문서\WindowsPowerShell\Modules\oh-my-posh\3.133.1\bin\posh-windows-amd64.exe came from.
from what I've checked, that path doesn't exist on my device.

@abiriadev
Copy link

abiriadev commented Sep 7, 2021

Strangely enough, Set-Theme works.

> Set-Theme Paradox

Hi there!

It seems you're using an oh-my-posh V2 cmdlet while running V3.
To migrate your current setup to V3, have a look the documentation.
https://ohmyposh.dev/docs/upgrading


Hi there!

It seems you're using an oh-my-posh V2 cmdlet while running V3.
To migrate your current setup to V3, have a look the documentation.
https://ohmyposh.dev/docs/upgrading

(it actually printed out twice)

> Set-PoshPrompt Paradox
& : The term 'C:\Users\<username>\OneDrive\문서\WindowsPowerShell\Modules\oh-my-posh\3.133.1\bin\posh-windows-amd64.exe'

so I went to the mentioned site, then ran Update-Module -Name oh-my-posh -Scope CurrentUser, but nothing changed.

after I delete forcibly the "...\OneDrive\document\WindowsPowerShell\Modules\oh-my-posh" and install oh-my-posh by using choco, it works.

sorry I think it was just another path issue that doesn't relate to this issue.

@rjitsu
Copy link

rjitsu commented Sep 12, 2021

I've tried all the above things,
but still some error.

> Set-PoshPrompt -Theme Paradox

& : The term 'C:\Users\<username>\OneDrive\문서\WindowsPowerShell\Modules\oh-my-posh\3.133.1\bin\posh-windows-amd64.exe'
is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name,
or if a path was included, verify that the path is correct and try again.
At line:1 char:23
+ ... ression (@(&"C:\Users\<username>\OneDrive\문서\WindowsPowerShell\Modules ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\<username>\...ndows-amd64.exe:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Invoke-Expression : Cannot bind argument to parameter 'Command' because it is an empty string.
At line:1 char:19
+ ... -Expression (@(&"C:\Users\<username>\OneDrive\문서\WindowsPowerShell\Mod ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Invoke-Expression], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.Invo
   keExpressionCommand

I don't know where the path C:\Users\oro36\OneDrive\문서\WindowsPowerShell\Modules\oh-my-posh\3.133.1\bin\posh-windows-amd64.exe came from.
from what I've checked, that path doesn't exist on my device.

It works without the -Theme flag. Do this: Set-PoshPrompt Paradox

@as-if-khan
Copy link

as-if-khan commented Sep 12, 2021

Just use

Import-Module posh-git
Import-Module oh-my-posh
Set-Theme Paradox

on Microsoft.PowerShell_profile.ps1 file
and enjoy.

@ghost
Copy link

ghost commented Sep 22, 2021

For anyone still struggliong with this issue use Set-PoshPrompt, as JustDre said above, followed by the -Theme option. Here is an example:
Set-PoshPrompt -Theme pixelrobots
I am using posh-git version 1.0.0 and oh-my-posh version 3.157.2.
Hope this helps
Set-PoshPrompt -Theme Paradox work!

@mohammednazim007
Copy link

mohammednazim007 commented Sep 28, 2021

Hey I'm getting this error, does anyone have a fix this error ? I'm trying to fix this error since last 3 days. But i can't do this properly because I'm new here in this sector. Anybody help me.
Screenshot_2

@zadjii-msft
Copy link
Member

@najima1 From literally 8 comments up in this thread: #9237 (comment)

I did Update_Module in Powershell, it will update the oh-my-posh module to lastest version

@Guezza
Copy link

Guezza commented Oct 9, 2021

I did Update-Module in Powershell,

@ThandoBhebhe
Copy link

If you are getting Set-PoshPromp is not recognised...

  1. Try outputting the path of your PROFILE file in your terminal using $PROFILE
    This directory is where your PROFILE should be, create it if its not there.

  2. And then write the Set-PoshPrompt -Theme the_theme_you_want script in your Microsoft.Powershell_profile.ps1 file instead of the terminal

  3. Save the configuration to your Microsoft.Powershell_profile.ps1 by entering . $PROFILE in your terminal

Your prompt should now have your chosen theme applied to it.

This worked for me, hope it helps 😊

@hanskoppvi
Copy link

hanskoppvi commented Nov 18, 2021

I have tried everything of the above but nothing worked. oh-my-posh was the only command that my powershell would find.

What worked for me is using the following command that is in this guide (I had to use the whole path to where the themes are):

oh-my-posh --init --shell pwsh --config ~\AppData\Local\Programs\oh-my-posh\themes\bubblesline.omp.json | Invoke-Expression

Saved this in the Microsoft.Powershell_profile.ps1 file and it works now.

I was also missing some characters so i downloaded the cascadia-code-nerd-font (I used chocolatey for it).

choco install cascadia-code-nerd-font

And then selected it in the windows terminal go to Settings -> Profiles -> PowerShell -> Appearance -> Font face on the windows terminal

I hope this methods helps someone!

@none-08
Copy link

none-08 commented Jan 2, 2022

It seems the "Set-Theme" cmdlet was renamed to "Set-PoshPrompt".

THANKS A LOT )

@snowlyg
Copy link

snowlyg commented Mar 7, 2022

For anyone still struggliong with this issue use Set-PoshPrompt, as JustDre said above, followed by the -Theme option. Here is an example:
Set-PoshPrompt -Theme pixelrobots
I am using posh-git version 1.0.0 and oh-my-posh version 3.157.2.
Hope this helps
Set-PoshPrompt -Theme Paradox work!

For anyone still struggliong with this issue use Set-PoshPrompt, as JustDre said above, followed by the -Theme option. Here is an example:
Set-PoshPrompt -Theme pixelrobots
I am using posh-git version 1.0.0 and oh-my-posh version 3.157.2.
Hope this helps
Set-PoshPrompt -Theme Paradox work!

It's worked!

@Maracaipe611
Copy link

Maracaipe611 commented Mar 28, 2022

I updated my ExecutionPolicy to Unrestricted and then installed the Modules Again, and finally worked!
Set-ExecutionPolicy unrestricted
Install-Module oh-my-posh -Scope CurrentUser
Install-Module posh-git -Scope CurrentUser
Set-PoshPrompt -Theme Paradox

@gumodi35
Copy link

Segui los pasos de actualizar el ExecutionPolicy a Unrestricted y luego instale los modulos de nuevo y sigue saliendo el error 😢

Alguna idea de como resolverlo? ❓
Captura de pantalla (2)

@EdgarIgnite16
Copy link

Hey guys! How I can update/upgrade OH-MY_POSH to the latest version?

@LeonardoCalazans
Copy link

Eu não entendo porque este aviso e o porque como admin não funciona o tema.
I don't understand why this warning and why as admin the theme doesn't work.

image

@DHowett
Copy link
Member

DHowett commented Feb 13, 2023

Please file a bug on the Oh-My-Posh project. :)

@microsoft microsoft locked as resolved and limited conversation to collaborators Feb 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Issue-Docs It's a documentation issue that really should be on MicrosoftDocs/Console-Docs Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Resolution-External For issues that are outside this codebase
Projects
None yet
Development

No branches or pull requests