Commands in PowerShell
This
post describes the commands used in PowerShell. Basically there are four types
of commands as listed below.
- Cmdlets
- Functions
- Native
- Scripts
Cmdlets
Cmdlets (pronounced
as command-let) support a normalized naming scheme with the verb-noun syntax.
PowerShell has built-in cmdlets such as get-process, get-help and where-object.
Developers also can create new cmdlets and register them with the PowerShell
host.
Functions
When the commands and statements
are organized into a reusable chunk of code we name it as functions.
Native
Native
commands run outside the PowerShell process. They are very simple. When you
open a .doc file in Microsoft Word you are using a native command.
Scripts
Scripts let us save a commonly used set of commands to a file. Normally scripts
have .ps1 extension.
Scripts
are called from PowerShell by file name. If your PowerShell’s current location
is the same as the location of the script you can execute the script by placing
a “./” in front of the script name.
Scripts
will not run by default. PowerShell allows you to set a script execution
policy. To set the Execution Policy
1. Type
set-executionpolicy -ExecutionPolicy Unrestricted
2. Click Enter to execute.
No comments:
Post a Comment