Error adding Starship command line in Windows PowerShell profile
Simple solution
Invoke-Expression (& 'C:\Users\psayeed1990\scoop\apps\starship\current\starship.exe' init powershell --print-full-init | Out-String)
Change the link of your starship.exe as you need.
For further read, This is how I solved this...
Creating the file with notepad didn't work for me
First, if your PowerShell $profile doesn't exist, create a profile with this command in command line (creating the file with Notepad doesn't work).
if (!(Test-Path -Path $PROFILE)) {
New-Item -ItemType File -Path $PROFILE -Force
}
Second, if you command notepad $profile, you can see, edit and save the file. Copy this code from official Starship site and paste it in the end of the $profile file Invoke-Expression (&starship init powershell)
.
Third, if it doesn't work, you may want to install vcredist2019. scoop install vcredist2019 didn't work for me. So, I downloaded from the official site.
Fourth, installing the vcredist2019 didn't solve it too. As @Olaf pointed out in the comment, you need quotation mark instead of parentheses, Invoke-Expression "&starship init powershell"
.
I don't think quotation is the way to write. If you restart your PowerShell and it doesn't work yet, you may still see a error or a line giving you the command with exact path to the Starship executable.
Fifth, replace the above code Invoke-Expression "&starship init powershell"
in the $profile with that line.
Invoke-Expression (& 'C:\Users\psayeed1990\scoop\apps\starship\current\starship.exe' init powershell --print-full-init | Out-String)
I hope this works.