Forum Discussion
Daniel Westerdale
Apr 25, 2024Copper Contributor
Fix a broken $Profie location
A couple of days ago I remove Documents from OneDrive which seems to have broken the "Oh my POSH" settings in my various terminals.
PowerShell 7.4.2
PS C:\Dev> $home
C:\Users\daniel
PS C:\Dev> $Profile
\PowerShell\Microsoft.PowerShell_profile.ps1
PS C:\Dev>
It looks like $Profle has lost the preceding C:\Users\daniel\Documents\PowerShell, so is there a way to re-add it, without needing to reinstall PowerShell Core and Windows PowerShell?
Ah in my case I have C:\Users\daniel\OneDrive and also through syncing with the other laptop the C:\Users\danie\OneDrive ( I originally caused issue with my bad spelling lol.)
So do I correct all the ones with the incorrect spelling given I have corrected the issue with the profile name.
Daniel Westerdale Does this work? This recreates the profile in it's default location.
New-Item $profile -Force
- Daniel WesterdaleCopper Contributor
Thanks for the reply.
I opened my windows terminal and entered both
# attempt 1 New-Item $profile # attempt 2 New-Item $profile -Value C:\Users\daniel\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 -force -ItemType File
Unfortunately, neither work.
- Is the file created afterward? And if you re-enable the OneDrive backup, does it work?