PowerShell Move-Item Cmdlet

PowerShell Move-Item Cmdlet

PowerShell Move-Item Cmdlet

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In the last blog post, we have discussed Copy-Item cmdlet in PowerShell.

https://cloudaffaire.com/powershell-copy-item-cmdlet/

In this blog post, we will discuss Move-Item cmdlet in PowerShell. You can use Move-Item cmdlet to move files, folders, registry keys etc. from one location to another. Move-Item cmdlet is equivalent to cut and paste operation where the source item is copied to the destination and then deleted.

Move-Item Cmdlet Syntax:

Move-Item Cmdlet Argument List:

  • Confirm: Prompts you for confirmation before running the cmdlet.
  • Credential: To impersonate another user or elevate your credentials.
  • Destination: Specifies the path to the new location. The default is the current directory. To rename the item being copied, specify a new name in the value of the Destination parameter.
  • Exclude: Specifies, as a string array, an item or items that this cmdlet excludes in the operation. The value of this parameter qualifies the Path parameter.
  • Filter: Specifies a filter to qualify the Path parameter. The FileSystem provider is the only installed PowerShell provider that supports the use of filters.
  • Force: Forces the cmdlet to remove items that cannot otherwise be changed, such as hidden or read-only files or read-only aliases or variables.
  • Include: Specifies, as a string array, an item or items that this cmdlet includes in the operation. The value of this parameter qualifies the Path parameter.
  • LiteralPath: Specifies a path to one or more locations. The value of LiteralPath is used exactly as it is typed. No characters are interpreted as wildcards.
  • PassThru: Returns an object that represents the item with which you’re working. By default, this cmdlet doesn’t generate any output.
  • Path: Specifies a path of the items being removed. Wildcard characters are permitted.
  • UseTransaction: Includes the command in the active transaction. This parameter is valid only when a transaction is in progress.
  • WhatIf: Shows what would happen if the cmdlet runs. The cmdlet is not run.

PowerShell Move-Item Cmdlet:

Move A File From One Location To Another In PowerShell:

Move A File From One Location To Another Renaming It In PowerShell:

Move Multiple Files At Once In PowerShell:

Move A Directory From One Location To Another In PowerShell:

Move A Directory From One Location To Another Renaming It In PowerShell:

Move A Directory Along With Its Content (Recursively) In PowerShell:

Hope you have enjoyed this article. In the next blog post, we will discuss Clear-Item cmdlet in PowerShell.

To get more details on PowerShell, kindly follow below official documentation

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about?view=powershell-5.1

 

Leave a Reply

Close Menu