Powershell Command does not execute in Powershell Script?
Posted on 2011-09-13
I have created a single line Powershell Script - Path.ps1. The single command is
The 'Path.ps1' script is in "C:\WINDOWS\system32\WindowsPowerShell\v1.0\PS1" Directory. If I execute the Path.ps1 script, while in that specific Directory. I get following error msg.
PS C:\WINDOWS\system32\WindowsPowerShell\v1.0\PS1> path.ps1
The term 'path.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:9
+ path.ps1 <<<<
+ CategoryInfo : ObjectNotFound: (path.ps1:String) , CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
If I execute this command at the PowerShell Command Prompt it executes.
PS C:\WINDOWS\system32\WindowsPowerShell\v1.0\PS1\ls and I I get a directory list written to console.
Why does ' Path.ps1' script fail, when the 'ls' command executes?
Thanks for any assistance in understanding this.