共用方式為


CommandInvocationIntrinsics Class

Definition

Interfaces that cmdlets can use to build script blocks and execute scripts.

public ref class CommandInvocationIntrinsics
public class CommandInvocationIntrinsics
type CommandInvocationIntrinsics = class
Public Class CommandInvocationIntrinsics
Inheritance
CommandInvocationIntrinsics

Properties

CommandNotFoundAction

This event handler is called when a command is not found. If should have a single string parameter that is the name of the command and should return a CommandInfo object or null. By default it will search the module path looking for a module that exports the desired command.

HasErrors

If an error occurred while executing the cmdlet, this will be set to true.

LocationChangedAction

Gets or sets the action that is invoked every time the runspace location (cwd) is changed.

PostCommandLookupAction

This event handler is after the command lookup is done but before the event object is returned to the caller. This allows things like interning scripts to work. If should have a single string parameter that is the name of the command and should return a CommandInfo object or null.

PreCommandLookupAction

This event handler is called before the command lookup is done. If should have a single string parameter that is the name of the command and should return a CommandInfo object or null.

Methods

ExpandString(String)

Returns a string with all of the variable and expression substitutions done.

GetCmdlet(String)

Returns the CmdletInfo object that corresponds to the name argument.

GetCmdletByTypeName(String)

Get the cmdlet info using the name of the cmdlet's implementing type. This bypasses session state and retrieves the command directly. Note that the help file and snapin/module info will both be null on returned object.

GetCmdlets()

Returns a list of all cmdlets...

GetCmdlets(String)

Returns all cmdlets whose names match the pattern...

GetCommand(String, CommandTypes, Object[])

Returns a command info for a given command name and type, using the specified arguments to resolve dynamic parameters.

GetCommand(String, CommandTypes)
GetCommandName(String, Boolean, Boolean)

Searches for PowerShell commands, optionally using wildcard patterns and optionally return the full path to applications and scripts rather than the simple command name.

GetCommands(String, CommandTypes, Boolean)

Searches for PowerShell commands, optionally using wildcard patterns.

InvokeScript(Boolean, ScriptBlock, IList, Object[])

Invoke a scriptblock in the current runspace, controlling if it gets a new scope.

InvokeScript(SessionState, ScriptBlock, Object[])

Executes a given scriptblock synchronously in the given session state. The scriptblock will be executed in the calling scope (dot-sourced) rather than in a new child scope.

InvokeScript(String, Boolean, PipelineResultTypes, IList, Object[])

Executes a piece of text as a script synchronously using the options provided.

InvokeScript(String, Object[])

Executes a piece of text as a script synchronously in the caller's session state. The given text will be executed in a child scope rather than dot-sourced.

InvokeScript(String)

Executes a piece of text as a script synchronously in the caller's session state. The given text will be executed in a child scope rather than dot-sourced.

NewScriptBlock(String)

Compile a string into a script block.

Applies to