Categories
User Help

Powershell won’t run ps1 files

Completely baffled by this. Can’t seem to run any ps1 files on powershell?? I know for sure it was working fine last week.

Here is the error I’m getting. It suggests the file doesn’t exist, so I proved it does by using Test-Path first…

PS C:\WINDOWS\system32> cd C:\Users\Public
if (Test-Path test.ps1) {
    ./test.ps1
}
./test.ps1 : The term './test.ps1' 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:3 char:5
+     ./test.ps1
+     ~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (./test.ps1:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Any suggestions of what I could try?

Doesn’t seem to be related to permissions. I was originally running from a network drive, but same result from C drive. Restarted the PC 2 times already. I’m not aware of any changes made to my PC in the last week that could have caused this?

Leave a Reply

Your email address will not be published. Required fields are marked *