New
#1
How to let *.ps1 scripts be automatically executed by powershell?
I am working on 64bit Windows 10 22H2 with installed Powershell v5.1.19041
When I open now a command prompt and enter a command like
test.ps1
then the PS script test.ps1 is NOT executed but an editor pops up showing me the textual content of file test.ps1
How can I tell Windows Command Prompt to execute all *.ps1 files automatically by powershell?
Even worse: if I enter (at the command prompt)
powershell test.ps1
I am getting an error:
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:1 char:1
+ test.ps1
+ ~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (test.ps1:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
So even if I force Windows 10 to use powershell for executing the *.ps1 script it doesn't work.
If I enter simply
powershell
then powershell interpreter is found and shows:
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
Any other solution?