0

While learning Anaconda I had a problem with "cd" not working in Anaconda PowerShell, so I did what is recommended here, manually created a profile and set the path to a specific folder. It worked.

But today somehow I found "cd" is working for me again, so I was going to delete that ps1 file. But the folder together with the file in that was no loner there, completely gone. Now I am stuck with my temporary path on every PowerShell start-up.

According to Microsoft documentation, $profile should return my profile variables, which it did:

C:\Users\myname\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

But first, this is not the file name I gave it; second, this path is also non-existent, both folder and file.

I tried notepad $profile, then Notepad told me "The system cannot find the path specified." But it is exactly the path the system told me.

Some answer I saw here says that is because my profile is non-existent, I need to create one first. That is not the case here. I definitely overwrote my starting path, but I cannot find the actual profile file to edit that back.

I also tried doing it the same way again but changing "YOUR_FILE_PATH" into "%Home" hoping to "overwrite" it back, yet somehow this time it did not work and the file did not disappear as it did the first time.

I am really confused on this.

TOuyang
  • 321
  • 1
  • 2
  • 8
  • Try `$profile | get-member -name *user*` to list all candidate locations, see my answer [here](https://stackoverflow.com/a/61493662/5538420) why. – dxiv Nov 13 '20 at 06:28
  • Hi @dxiv, I got the other locations in C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.PowerShell_profile.ps1. But there is no file with that name in the folder. – TOuyang Nov 23 '20 at 01:14
  • The defaults PS starts with must come from one of those 4 files. If one is not present then it's not used. – dxiv Nov 23 '20 at 03:23

1 Answers1

0

If you want to reset PowerShell to the original settings when PowerShell was installed.

  1. Uninstall PowerShell from the Add or Remove Programs.
  2. Restart your computer.
  3. Reinstall PowerShell.
Shaqil Ismail
  • 1,794
  • 1
  • 4
  • 5