Getting “the syntax of the command is incorrect” is incorrect” error

Asked By 30 points N/A Posted on -
qa-featured

I am new on the command line so do not know much about it. As I type any command I got an error “the syntax of the command is incorrect” what does it means actually. Do I  write the wrong command. Also, experts please provide me the way to solve it.

SHARE
Answered By 0 points N/A #146249

Getting “the syntax of the command is incorrect” is incorrect” error

qa-featured

Yes, the error comes when yo writes the command syntax wrong. The command may be correct, but the syntax of the command is not correct. Use the quotes instead of spaces. For example, if you want to type the directory document text type it in quotes “document text.txt”.
For example, if you want to copy the document text file to flash directory, type the command like this copy “document test.txt” flash this command will copy the document text file to the flash directory.
If you want to move the document text file to flash directory write the following command move “document text.txt” flash. This command will move the file into the flash directory.

Answered By 590495 points N/A #344404

Getting “the syntax of the command is incorrect” is incorrect” error

qa-featured

If you are referring “command line” to the DOS prompt in Windows, you must learn different DOS commands first before you can run a command. Whether you’re in the original DOS prompt booted your computer with DOS operating system from a diskette or accessing the DOS prompt or command prompt from within Windows, everything you do or type on the screen has to be initiated with a command.

This is probably the reason why you get a syntax error when running a command because you don’t know how to exactly execute the command. If you want to learn some DOS commands, here are a few:

Echo – this command displays messages in the DOS environment. It also turns on or off the command-echoing. This is mostly used in batch files (.bat) to display messages on the screen. If the command-echoing is not turned off, it will display the command for every line. This is normally turned off in batch files.

The echo command is turned on by default unless a previous command turned it off. Syntax:

Echo [on/off]
Echo [message]

Example with echo turned on:

@echo on
Echo Hello world!

Output:

C:\>Echo Hello world!

Example with echo turned off:

@echo off
Echo Hello world!

Output:

Hello world!

Del – this command deletes one or more files. Syntax:

DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names

When the “/p” switch is used, it will prompt you before deleting every file. When the “/f” switch is used, it force deletes read-only files. When the “/s” is used, it will delete the particular file from all subdirectories or subfolders. The “/q” switch is the quiet mode. It will not prompt you when deleting files when using wildcard.

When the “/a” switch is used, it will select files to delete according to attributes (“r” for read-only files, “h” for hidden files, “s” for system files, and “a” for files ready for archiving). Example:

C:\>del file.doc /p

If you want to learn more DOS commands, visit List of useful and frequently used DOS Commands [https://www.tipsandtricks-hq.com/list-of-useful-and-frequently-used-dos-commands-317]. To learn how to use a particular command, in the command prompt, type the command followed by without quotes “/?” with or without space in between then hit Enter. Another way is to type without quotes “help” followed by a space then the command.

For example:

dir/?
dir /?
help dir

Related Questions