terminal icon indicating copy to clipboard operation
terminal copied to clipboard

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

Open nihaltowfiq opened this issue 5 years ago • 29 comments

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

nihaltowfiq avatar Feb 21 '21 14:02 nihaltowfiq

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 avatar Feb 22 '21 01:02 DHowett

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

JustDre avatar Mar 14 '21 14:03 JustDre

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

wys-wys avatar Apr 01 '21 06:04 wys-wys

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

image

glaucia86 avatar May 06 '21 01:05 glaucia86

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".

nihaltowfiq avatar May 06 '21 06:05 nihaltowfiq

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

iulianoana avatar May 27 '21 10:05 iulianoana

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

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

sajadshafi avatar Jul 14 '21 03:07 sajadshafi

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.

Wineric avatar Aug 03 '21 08:08 Wineric

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

I followed the tutorial in the Terminal docs here

image

GeoBrodas avatar Aug 12 '21 08:08 GeoBrodas

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.

jiyulei avatar Aug 12 '21 14:08 jiyulei

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

GeoBrodas avatar Aug 12 '21 14:08 GeoBrodas

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.

zjteachen avatar Sep 06 '21 04:09 zjteachen

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 avatar Sep 07 '21 10:09 abiriadev

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.

abiriadev avatar Sep 07 '21 11:09 abiriadev

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

rjitsu avatar Sep 12 '21 10:09 rjitsu

Just use

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

on Microsoft.PowerShell_profile.ps1 file and enjoy.

as-if-khan avatar Sep 12 '21 18:09 as-if-khan

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!

ghost avatar Sep 22 '21 11:09 ghost

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

mohammednazim007 avatar Sep 28 '21 10:09 mohammednazim007

@najima1 From literally 8 comments up in this thread: https://github.com/microsoft/terminal/issues/9237#issuecomment-897701306

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

zadjii-msft avatar Sep 28 '21 11:09 zadjii-msft

I did Update-Module in Powershell,

Guezza avatar Oct 09 '21 11:10 Guezza