1

At some point, I created a startup file for cmd and powershell. Ending in .ps1 I think. I must have a typo in it or something because I now get this error in powershell when trying to run commands:

& was unexpected at this time.

Also, CMD won't open. And if I try to run it from powershell I get the error.

I can't remember where that darn file is. I've looked all over for it, including all of the places listed here: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7.2#the-profile-files

$profile isn't the answer.

Any ideas for where it could be and how to find it?

7
  • Use AutoRuns to find the startup file you created. What did the startup file do exactly?
    – Ramhound
    Commented Jul 19, 2023 at 21:32
  • I was trying to get micromamba to work on terminal startup.
    – abalter
    Commented Jul 19, 2023 at 21:50
  • If you have wiped the PowerShell profiles, and have removed the system variable you have created, I fall back to using AutoRuns to identify the script that is automatically being ran. You’ll have to search your own system for the file. We can’t actually tell you where the file is.
    – Ramhound
    Commented Jul 19, 2023 at 22:13
  • I ran AutoRuns, and didn't see anything useful--for instance a file that would run when I launch cmd. Maybe there is a switch I can use with cmd.exe to tell it to run "vanilla" and not run startup files.
    – abalter
    Commented Jul 19, 2023 at 22:14
  • So, I opened powershell and ran cmd.exe \d and appeared to get a command prompt. But whenever I run a command I still get that error. So maybe it's not a startup thing. What would cause cmd to run a certain file EVERY time it runs a command?
    – abalter
    Commented Jul 19, 2023 at 22:17

0

You must log in to answer this question.

Browse other questions tagged .