This is a common error we would encounter while working with windows command prompt. It means that there’s something wrong in the arguments passed on to the command. Reasons could be any of the below.
- Not passing the right parameters to the command. For example,
Rmdircommand expects the directory name to be provided. Not adding this argument causes the error as below.
c:\>rmdir The syntax of the command is incorrect.
- Passing more arguments than the command accepts
c:\>move file1 file2 file3 The syntax of the command is incorrect.
Movecommand expects only two arguments, one for the actual file and the other for the destination file. Adding an extra argument causes the command to fail with the error.
- This error can also occur even if we are passing the right number of arguments but the argument is not in the expected format. For example, ‘mkdir’ expects the directory path to be in the windows format like
dir1\dir2. If you specify the path in Linux format as in
dir1/dir2, it causes the error.
c:\>mkdir dir1/dir2 The syntax of the command is incorrect.
How to resolve the error
If you encounter this error, the next thing to do is to check the usage of the command and identify what’s wrong in the command you ran. You can refer articles on this websiste for understanding syntax and example use cases. All the articles for windows commands are listed here. Windows commands reference.
Also, we can find the usage of a command by running the command with an argument
/?. For example to check the usage of
shutdown command, you can find it as below.
Please add to the comments below if you are not able to fix the issue. I would do my best to reply back with a solution.