WIPIVERSE All articles

move (command)

move is a shell command used for renaming and moving files and directories across various operating systems. It is an internal command available in multiple command-line interpreters, including COMMAND.COM (MS-DOS), the Windows Command Prompt (cmd.exe), 4DOS/4NT, and as a predefined alias for the Move-Item cmdlet in PowerShell.

Availability

The move command is available in a wide range of operating systems: MS-DOS (version 6.0 and later), PC DOS, MSX-DOS, DR DOS 6.0, FreeDOS, OS/2, eComStation, ArcaOS, Windows, and ReactOS. The FreeDOS version was developed by Joe Cosentino, and the ReactOS version is written in C under the GPLv2 license. The open-source MS-DOS emulator DOSBox does not include a MOVE command; instead, the REN command can be used to move files.

Syntax

The general syntax for the command is:

move [{/y|/-y}] [<source>] [<target>]
  • source: Specifies the path and name of the file(s) or directory to move. Wildcards are supported for pattern matching.
  • target: Specifies the destination path and name.

Options

  • /y – Suppresses prompting to confirm overwriting an existing destination file. This behavior can be preset via the COPYCMD environment variable.
  • /-y – Forces prompting to confirm overwriting an existing destination file, overriding any preset.

By default, the command prompts before overwriting files unless it is executed from within a batch script.

Behavior

When moving a file or directory named foo to a target bar:

  • If bar does not exist, foo is renamed to bar.
  • If bar is an existing directory, foo is moved into bar, resulting in the path bar\foo.

Moving encrypted files to a volume that does not support Encrypting File System (EFS) results in an error; the files must first be decrypted or moved to an EFS-compatible volume.

Examples

move foo bar

Renames the file or directory foo to bar, or moves foo into the directory bar if bar already exists.

move \data\*.xls \second_q\reports\

Moves all files with the .xls extension from the \data directory to the \second_q\reports\ directory.

Related Commands

The move command is analogous to the Unix/Linux mv command and to the OpenVOS move_file and move_dir commands. It is part of the broader set of DOS and Windows command-line utilities for file management.

Browse

More topics to explore

    Browse all articles