KB IssueRenaming a file with spaces in the name will give you an error when using a DOS Prompt or Command Prompt.
Issue DetailsWhen using a DOS prompt or command prompt and trying to rename a file that has spaces in the name, my file.txt will result in an error.
File Rename Error
The syntax of the command is incorrect
.
The use of Wildcards will be needed to rename your spaced files and folders
Recreate IssuePerform the following action in a command prompt
Substituting the U:\Files For your actual drive and folder path.
U:\Files\rename my file.txt my file.doc
The command syntax is incorrect.
Resolve IssueTo properly write out the DOS command to rename your file with spaces, perform the following action. This command will come in handy if you are unable to rename the file in Windows because it is in use.
U:\Files\rename my?file.txt my?file.doc
As you can see above, we have added a Question Mark ? In place of the spaces in the name of the file.
What this does is give a legal DOS filename character.
If you leave the ? mark off from the output filename like this
U:\Files\rename my?file.txt my file.doc
The output renamed file will be my file.doc
See, the ? in the original filename adds an underscore to the output filename.
But adding the ? to the output filename lets you rename the file with the original space still intact.