Last updated: Apr 4, 2024
Reading timeยท6 min
If you got the error "'mv' is not recognized as an internal or external command", click on the second subheading.
The error "'rm' is not recognized as an internal or external command, operable
program or batch file" occurs when we use the rm
command on Windows, in a CMD
shell.
To solve the error, use the del
command to delete one or more files.
The del
command is the Windows equivalent of the rm
command.
# ๐๏ธ delete a file named example.txt del example.txt # ๐๏ธ delete all files in a folder named Test123 on drive C del c:\test123 # ๐๏ธ if the folder has a space in its name, wrap the path in double quotes del "c:\test folder\"
You can check other examples of using the del
command in
this section
of the docs.
There is also an rd command.
The rd
command deletes a directory.
# ๐๏ธ remove a directory named test123, all its subdirectories and files rd /s "test123" # ๐๏ธ same command, but in quiet mode rd /s /q "test123"
Note that you can use the rm
command in PowerShell.
To open PowerShell:
Use the rm
command directly in PowerShell to remove a file.
rm example.txt
If you need to open PowerShell in a specific folder:
Shift
and right-click in Explorer.rm
command.rm example.txt
rm
command in Git Bash by installing git
on your Windows machine.If you already have git
installed, you can search for Git Bash
and use the
rm
command, otherwise, you have to install git
first.
rm
command in Git BashTo download git
and be able to use Git Bash:
Next
.Next
.Click Next
on the screen that prompts you to "Select Start Menu Folder".
On the next screen, you can choose the default editor for Git
, e.g.
Notepad
, Notepad++
or any other editor you prefer.
Next
.Next
.Install
button to install git
.Once you have git
installed, click on the Search field, type "Git Bash"
and start the application.
Now you can use the rm
command directly in Git Bash.
rm example.txt
If you need to open Git Bash in a specific folder:
Now you can use the rm
command to delete a file.
rm example.txt
The error "'mv' is not recognized as an internal or external command, operable
program or batch file" occurs when we use the mv
command on Windows, in a CMD
shell.
To solve the error, use the move
command to move one or more files from one
directory to another.
The move
command is the Windows equivalent of the Unix mv
command.
# ๐๏ธ Move a file called my_file.txt to my_folder move my_file.txt my_folder # ๐๏ธ Move all files with .xls extension from the \Data directory to \second_q\reports directory move \data\*.xls \second_q\reports\
You can check out the parameters the command takes and some examples in this section of the docs.
If you get a permissions error, you have to open CMD in administrator mode to be able to use the command.
To open CMD as an administrator:
Click on the Search bar and type CMD.
Right-click on the Command Prompt application and click "Run as administrator".
move
command.mv
command in PowerShell on WindowsNote that you can use the mv
command in PowerShell.
To open PowerShell:
Use the mv
command directly in PowerShell to move one or more files from one
directory to another.
mv my_file.txt my_folder
If you need to open PowerShell in a specific folder:
Shift
and right-click in Explorer.mv
command.mv
command in Git Bash by installing git
on your Windows machine.If you already have git
installed, you can search for Git Bash
and use the
mv
command, otherwise, you have to install git
first.
mv
command in Git BashTo download git
and be able to use Git Bash:
Next
.Next
.Click Next
on the screen that prompts you to "Select Start Menu Folder".
On the next screen, you can choose the default editor for Git
, e.g.
Notepad
, Notepad++
or any other editor you prefer.
Next
.Next
.Install
button to install git
.Once you have git
installed, click on the Search field, type "Git Bash"
and start the application.
Now you can use the mv
command directly in Git Bash.
mv my_file.txt my_folder
If you need to open Git Bash in a specific folder:
Now you can use the mv
command to move one or more files from one directory to
another.
mv my_file.txt my_folder
You can learn more about the related topics by checking out the following tutorials: