On Jul 14, 9:08 am, Marco <Ma...@discussions.microsoft.com> wrote:
> Sorry, I am new in Powershell. I have tried to run scripts but I get the
> error message:
>
> The term 'directorylistwitharguments.ps1' is not recognized as a cmdlet,
> function, operable program, or script file. Verify the term and try again.
>
> I have changed the execution policy:
> Set-ExecutionPolicy unrestricted
>
> Although, I get the same error message.
>
> Any help will be appreciated.
>
> M.
A few options here (after you've checked that the script is named
properly, of course!):
1. If you've already navigated to your script directory, use:
..\directorylistwitharguments.ps1
2. Otherwise use the full pathname:
& "C:\Scripts\directorylistwitharguments.ps1"
3. Or for convenience, add your scripts directory to the $env

ath
like so:
$env

ath += ";C:\Scripts"
Very handy to add that line to your $profile, then you can just call
the script from the command line with its name only:
directorylistwitharguments
4. That's a long name! Maybe use an alias instead? Like so:
new-alias -name dirwa -value "C:\Scripts
\directorylistwitharguments.ps1"
Again, this can be added to your $profile for maximum convenience.
-Hecks