Búsqueda de sitios web

Verbos aprobados para comandos de PowerShell


PowerShell usa un par verbo-sustantivo para los nombres de los cmdlets y para sus clases .NET derivadas. La parte verbal del nombre identifica la acción que realiza el cmdlet. La parte sustantiva del nombre identifica la entidad sobre la cual se realiza la acción. Por ejemplo, el cmdlet Get-Command recupera todos los comandos registrados en PowerShell.

Nota

PowerShell usa el término verbo para describir una palabra que implica una acción incluso si esa palabra no es un verbo estándar en el idioma inglés. Por ejemplo, el término Nuevo es un nombre de verbo de PowerShell válido porque implica una acción aunque no sea un verbo en el idioma inglés.

Cada verbo aprobado tiene un prefijo de alias correspondiente definido. Usamos este prefijo de alias en alias para comandos que usan ese verbo. Por ejemplo, el prefijo de alias para Importar es ip y, en consecuencia, el alias para Import-Module es ipmo . Esta es una recomendación pero no una regla; en particular, no es necesario respetarlo para los alias de comandos que imitan comandos bien conocidos de otros entornos.

Recomendaciones para nombrar verbos

Las siguientes recomendaciones le ayudarán a elegir un verbo adecuado para su cmdlet, para garantizar la coherencia entre los cmdlets que cree, los cmdlets proporcionados por PowerShell y los cmdlets diseñados por otros.

  • Utilice uno de los nombres de verbos predefinidos proporcionados por PowerShell
  • Utilice el verbo para describir el alcance general de la acción y utilice parámetros para refinar aún más la acción del cmdlet.
  • No utilice sinónimos de un verbo aprobado. Por ejemplo, utilice siempre Eliminar, nunca utilice Eliminar o Eliminar.
  • Utilice únicamente la forma de cada verbo que se enumera en este tema. Por ejemplo, utilice Get, pero no utilice Getting ni Gets.
  • No utilice los siguientes verbos reservados o alias. El lenguaje PowerShell y unos pocos cmdlets utilizan estos verbos en circunstancias excepcionales.

    • Para cada uno (para cada uno)
    • silbido (pi)
    • Ordenar (sr)
    • te (te)
    • donde (wh)

Puede obtener una lista completa de verbos utilizando el cmdlet Get-Verb.

Verbos similares para diferentes acciones

Los siguientes verbos similares representan acciones diferentes.

Nuevo versus Agregar

Utilice el verbo New para crear un nuevo recurso. Utilice Add para agregar algo a un contenedor o recurso existente. Por ejemplo, Add-Content agrega salida a un archivo existente.

Nuevo versus conjunto

Utilice el verbo New para crear un nuevo recurso. Utilice el verbo Set para modificar un recurso existente y, opcionalmente, crearlo si no existe, como el cmdlet Set-Variable.

Buscar versus buscar

Utilice el verbo Buscar para buscar un objeto. Utilice el verbo Buscar para crear una referencia a un recurso en un contenedor.

Obtener versus leer

Utilice el verbo Get para obtener información sobre un recurso (como un archivo) o para obtener un objeto con el que pueda acceder al recurso en el futuro. Utilice el verbo Leer para abrir un recurso y extraer la información contenida en él.

Invocar versus iniciar

Utilice el verbo Invoke para realizar operaciones sincrónicas, como ejecutar un comando y esperar a que finalice. Utilice el verbo Inicio para iniciar operaciones asincrónicas, como iniciar un proceso autónomo.

Ping versus prueba

Utilice el verbo Prueba.

Verbos comunes

PowerShell usa la clase de enumeración System.Management.Automation.VerbsCommon para definir acciones genéricas que se pueden aplicar a casi cualquier cmdlet. La siguiente tabla enumera la mayoría de los verbos definidos.

Verb (alias) Action Synonyms to avoid
Add (a) Adds a resource to a container, or attaches an item to another item. For example, the Add-Content cmdlet adds content to a file. This verb is paired with Remove. Append, Attach, Concatenate, Insert
Clear (cl) Removes all the resources from a container but does not delete the container. For example, the Clear-Content cmdlet removes the contents of a file but does not delete the file. Flush, Erase, Release, Unmark, Unset, Nullify
Close (cs) Changes the state of a resource to make it inaccessible, unavailable, or unusable. This verb is paired with Open.
Copy (cp) Copies a resource to another name or to another container. For example, the Copy-Item cmdlet copies an item (such as a file) from one location in the data store to another location. Duplicate, Clone, Replicate, Sync
Enter (et) Specifies an action that allows the user to move into a resource. For example, the Enter-PSSession cmdlet places the user in an interactive session. This verb is paired with Exit. Push, Into
Exit (ex) Sets the current environment or context to the most recently used context. For example, the Exit-PSSession cmdlet places the user in the session that was used to start the interactive session. This verb is paired with Enter. Pop, Out
Find (fd) Looks for an object in a container that is unknown, implied, optional, or specified. Search
Format (f) Arranges objects in a specified form or layout
Get (g) Specifies an action that retrieves a resource. This verb is paired with Set. Read, Open, Cat, Type, Dir, Obtain, Dump, Acquire, Examine, Find, Search
Hide (h) Makes a resource undetectable. For example, a cmdlet whose name includes the Hide verb might conceal a service from a user. This verb is paired with Show. Block
Join (j) Combines resources into one resource. For example, the Join-Path cmdlet combines a path with one of its child paths to create a single path. This verb is paired with Split. Combine, Unite, Connect, Associate
Lock (lk) Secures a resource. This verb is paired with Unlock. Restrict, Secure
Move (m) Moves a resource from one location to another. For example, the Move-Item cmdlet moves an item from one location in the data store to another location. Transfer, Name, Migrate
New (n) Creates a resource. (The Set verb can also be used when creating a resource that includes data, such as the Set-Variable cmdlet.) Create, Generate, Build, Make, Allocate
Open (op) Changes the state of a resource to make it accessible, available, or usable. This verb is paired with Close.
Optimize (om) Increases the effectiveness of a resource.
Pop (pop) Removes an item from the top of a stack. For example, the Pop-Location cmdlet changes the current location to the location that was most recently pushed onto the stack.
Push (pu) Adds an item to the top of a stack. For example, the Push-Location cmdlet pushes the current location onto the stack.
Redo (re) Resets a resource to the state that was undone.
Remove (r) Deletes a resource from a container. For example, the Remove-Variable cmdlet deletes a variable and its value. This verb is paired with Add. Clear, Cut, Dispose, Discard, Erase
Rename (rn) Changes the name of a resource. For example, the Rename-Item cmdlet, which is used to access stored data, changes the name of an item in the data store. Change
Reset (rs) Sets a resource back to its original state.
Resize(rz) Changes the size of a resource.
Search (sr) Creates a reference to a resource in a container. Find, Locate
Select (sc) Locates a resource in a container. For example, the Select-String cmdlet finds text in strings and files. Find, Locate
Set (s) Replaces data on an existing resource or creates a resource that contains some data. For example, the Set-Date cmdlet changes the system time on the local computer. (The New verb can also be used to create a resource.) This verb is paired with Get. Write, Reset, Assign, Configure
Show (sh) Makes a resource visible to the user. This verb is paired with Hide. Display, Produce
Skip (sk) Bypasses one or more resources or points in a sequence. Bypass, Jump
Split (sl) Separates parts of a resource. For example, the Split-Path cmdlet returns different parts of a path. This verb is paired with Join. Separate
Step (st) Moves to the next point or resource in a sequence.
Switch (sw) Specifies an action that alternates between two resources, such as to change between two locations, responsibilities, or states.
Undo (un) Sets a resource to its previous state.
Unlock (uk) Releases a resource that was locked. This verb is paired with Lock. Release, Unrestrict, Unsecure
Watch (wc) Continually inspects or monitors a resource for changes.

Verbos de comunicación

PowerShell usa la clase System.Management.Automation.VerbsCommunications para definir acciones que se aplican a las comunicaciones. La siguiente tabla enumera la mayoría de los verbos definidos.

Verb (alias) Action Synonyms to avoid
Connect (cc) Creates a link between a source and a destination. This verb is paired with Disconnect. Join, Telnet, Login
Disconnect (dc) Breaks the link between a source and a destination. This verb is paired with Connect. Break, Logoff
Read (rd) Acquires information from a source. This verb is paired with Write. Acquire, Prompt, Get
Receive (rc) Accepts information sent from a source. This verb is paired with Send. Read, Accept, Peek
Send (sd) Delivers information to a destination. This verb is paired with Receive. Put, Broadcast, Mail, Fax
Write (wr) Adds information to a target. This verb is paired with Read. Put, Print

Verbos de datos

PowerShell usa la clase System.Management.Automation.VerbsData para definir acciones que se aplican al manejo de datos. La siguiente tabla enumera la mayoría de los verbos definidos.

Verb Name (alias) Action Synonyms to avoid
Backup (ba) Stores data by replicating it. Save, Burn, Replicate, Sync
Checkpoint (ch) Creates a snapshot of the current state of the data or of its configuration. Diff
Compare (cr) Evaluates the data from one resource against the data from another resource. Diff
Compress (cm) Compacts the data of a resource. Pairs with Expand. Compact
Convert (cv) Changes the data from one representation to another when the cmdlet supports bidirectional conversion or when the cmdlet supports conversion between multiple data types. Change, Resize, Resample
ConvertFrom (cf) Converts one primary type of input (the cmdlet noun indicates the input) to one or more supported output types. Export, Output, Out
ConvertTo (ct) Converts from one or more types of input to a primary output type (the cmdlet noun indicates the output type). Import, Input, In
Dismount (dm) Detaches a named entity from a location. This verb is paired with Mount. Unmount, Unlink
Edit (ed) Modifies existing data by adding or removing content. Change, Update, Modify
Expand (en) Restores the data of a resource that has been compressed to its original state. This verb is paired with Compress. Explode, Uncompress
Export (ep) Encapsulates the primary input into a persistent data store, such as a file, or into an interchange format. This verb is paired with Import. Extract, Backup
Group (gp) Arranges or associates one or more resources
Import (ip) Creates a resource from data that is stored in a persistent data store (such as a file) or in an interchange format. For example, the Import-CSV cmdlet imports data from a comma-separated value (CSV) file to objects that can be used by other cmdlets. This verb is paired with Export. BulkLoad, Load
Initialize (in) Prepares a resource for use, and sets it to a default state. Erase, Init, Renew, Rebuild, Reinitialize, Setup
Limit (l) Applies constraints to a resource. Quota
Merge (mg) Creates a single resource from multiple resources. Combine, Join
Mount (mt) Attaches a named entity to a location. This verb is paired with Dismount. Connect
Out (o) Sends data out of the environment. For example, the Out-Printer cmdlet sends data to a printer.
Publish (pb) Makes a resource available to others. This verb is paired with Unpublish. Deploy, Release, Install
Restore (rr) Sets a resource to a predefined state, such as a state set by Checkpoint. For example, the Restore-Computer cmdlet starts a system restore on the local computer. Repair, Return, Undo, Fix
Save (sv) Preserves data to avoid loss.
Sync (sy) Assures that two or more resources are in the same state. Replicate, Coerce, Match
Unpublish (ub) Makes a resource unavailable to others. This verb is paired with Publish. Uninstall, Revert, Hide
Update (ud) Brings a resource up-to-date to maintain its state, accuracy, conformance, or compliance. For example, the Update-FormatData cmdlet updates and adds formatting files to the current PowerShell console. Refresh, Renew, Recalculate, Re-index

Verbos de diagnóstico

PowerShell usa la clase System.Management.Automation.VerbsDiagnostic para definir acciones que se aplican a los diagnósticos. La siguiente tabla enumera la mayoría de los verbos definidos.

Verb (alias) Action Synonyms to avoid
Debug (db) Examines a resource to diagnose operational problems. Diagnose
Measure (ms) Identifies resources that are consumed by a specified operation, or retrieves statistics about a resource. Calculate, Determine, Analyze
Ping (pi) Deprecated - Use the Test verb instead.
Repair (rp) Restores a resource to a usable condition Fix, Restore
Resolve (rv) Maps a shorthand representation of a resource to a more complete representation. Expand, Determine
Test (t) Verifies the operation or consistency of a resource. Diagnose, Analyze, Salvage, Verify
Trace (tr) Tracks the activities of a resource. Track, Follow, Inspect, Dig

Verbos del ciclo de vida

PowerShell usa la clase System.Management.Automation.VerbsLifeCycle para definir acciones que se aplican al ciclo de vida de un recurso. La siguiente tabla enumera la mayoría de los verbos definidos.

Verb (alias) Action Synonyms to avoid
Approve (ap) Confirms or agrees to the status of a resource or process.
Assert (as) Affirms the state of a resource. Certify
Build (bd) Creates an artifact (usually a binary or document) out of some set of input files (usually source code or declarative documents.) This verb was added in PowerShell 6.
Complete (cp) Concludes an operation.
Confirm (cn) Acknowledges, verifies, or validates the state of a resource or process. Acknowledge, Agree, Certify, Validate, Verify
Deny (dn) Refuses, objects, blocks, or opposes the state of a resource or process. Block, Object, Refuse, Reject
Deploy (dp) Sends an application, website, or solution to a remote target[s] in such a way that a consumer of that solution can access it after deployment is complete. This verb was added in PowerShell 6.
Disable (d) Configures a resource to an unavailable or inactive state. For example, the Disable-PSBreakpoint cmdlet makes a breakpoint inactive. This verb is paired with Enable. Halt, Hide
Enable (e) Configures a resource to an available or active state. For example, the Enable-PSBreakpoint cmdlet makes a breakpoint active. This verb is paired with Disable. Start, Begin
Install (is) Places a resource in a location, and optionally initializes it. This verb is paired with Uninstall. Setup
Invoke (i) Performs an action, such as running a command or a method. Run, Start
Register (rg) Creates an entry for a resource in a repository such as a database. This verb is paired with Unregister.
Request (rq) Asks for a resource or asks for permissions.
Restart (rt) Stops an operation and then starts it again. For example, the Restart-Service cmdlet stops and then starts a service. Recycle
Resume (ru) Starts an operation that has been suspended. For example, the Resume-Service cmdlet starts a service that has been suspended. This verb is paired with Suspend.
Start (sa) Initiates an operation. For example, the Start-Service cmdlet starts a service. This verb is paired with Stop. Launch, Initiate, Boot
Stop (sp) Discontinues an activity. This verb is paired with Start. End, Kill, Terminate, Cancel
Submit (sb) Presents a resource for approval. Post
Suspend (ss) Pauses an activity. For example, the Suspend-Service cmdlet pauses a service. This verb is paired with Resume. Pause
Uninstall (us) Removes a resource from an indicated location. This verb is paired with Install.
Unregister (ur) Removes the entry for a resource from a repository. This verb is paired with Register. Remove
Wait (w) Pauses an operation until a specified event occurs. For example, the Wait-Job cmdlet pauses operations until one or more of the background jobs are complete. Sleep, Pause

Verbos de seguridad

PowerShell usa la clase System.Management.Automation.VerbsSecurity para definir acciones que se aplican a la seguridad. La siguiente tabla enumera la mayoría de los verbos definidos.

Verb (alias) Action Synonyms to avoid
Block (bl) Restricts access to a resource. This verb is paired with Unblock. Prevent, Limit, Deny
Grant (gr) Allows access to a resource. This verb is paired with Revoke. Allow, Enable
Protect (pt) Safeguards a resource from attack or loss. This verb is paired with Unprotect. Encrypt, Safeguard, Seal
Revoke (rk) Specifies an action that does not allow access to a resource. This verb is paired with Grant. Remove, Disable
Unblock (ul) Removes restrictions to a resource. This verb is paired with Block. Clear, Allow
Unprotect (up) Removes safeguards from a resource that were added to prevent it from attack or loss. This verb is paired with Protect. Decrypt, Unseal

Otros verbos

PowerShell usa la clase System.Management.Automation.VerbsOther para definir nombres de verbos canónicos que no encajan en una categoría de nombre de verbo específica, como los verbos de nombres de verbos comunes, de comunicaciones, de datos, de ciclo de vida o de seguridad.

Verb (alias) Action Synonyms to avoid
Use (u) Uses or includes a resource to do something.

Ver también

  • Sistema.Gestión.Automatización.VerbosComunes
  • Sistema.Gestión.Automatización.VerbosComunicaciones
  • Sistema.Gestión.Automatización.VerbosDatos
  • Sistema.Gestión.Automatización.VerbosDiagnóstico
  • Sistema.Gestión.Automatización.VerbosCiclodevida
  • Sistema.Gestión.Automatización.VerbosSeguridad
  • Sistema.Gestión.Automatización.VerbosOtros
  • Declaración de cmdlet
  • Guía del programador de Windows PowerShell
  • SDK de shell de Windows PowerShell

Artículos relacionados