D:\test>REN "my Doc" "my Doc Backup" [ENTER]Type
D: est>DIR [ENTER]and you'll see that the subdirectory 'my Doc Backup' exists and 'my Doc' doesn't. Remember that it is a good idea to surround 'names' with space(s) by double quotation marks (double apostrophes).
D:\test>MOVE "my Doc" "my Doc Backup" [ENTER]
D:\test>REN file3.txt file3.dat [ENTER]In case of a bulk rename, you should write at the prompt
D:\test>REN *.txt *.dat [ENTER]It means that all files with extension '.txt' will get the extension '.dat'.
D:\test>REN * *.txt [ENTER]
D:\test>REN file1.txt file1_1.txt [ENTER]The '.txt' files in our example directory have the filenames: 'file1.txt', 'file2.txt' and 'file3.txt'. To uppercase the first letter 'f' of these filenames:
D:\test>REN f*.txt F*.txt [ENTER]Swap the parameters to lowercase the first character of a filename.
D:\test>REN ?*.txt T*.txt [ENTER]So 'file1.txt' will be renamed into 'Tile1.txt'.
D:\test>REN ??*.txt Ta*.txt [ENTER]So 'file1.txt' will be renamed into 'Tale1.txt'.
D:\test>REN ?i*.txt ?a*.txt [ENTER]So 'file1.txt' will be renamed into 'fale1.txt'.
D:\test>REN *i*.txt *a*.txtwith an * at the beginning of the pattern will not work. To replace the letter 'i' by an 'a' regardless its position, we have to use the 'FOR' loop (Chapter 10).
D:\test>REN ???*.txt ???.txt [ENTER]truncates the filename of all '.txt' files to the first three characters (three question marks ???). So: '1_file.txt' will be '1_f.txt'.
D:\test>CD "my Doc" [ENTER] D:\test\my Doc>REN "doc 1.rtf" doc_1.rtf [ENTER]Of course, this can be done in one command as well:
D:\test>CD "my Doc" & REN "doc 1.rtf" doc_1.rtf [ENTER]or
D:\test>REN "my Doc"\"doc 1.rtf" doc_1.rtf [ENTER]