Reputation: 216
I created a batch file to create a new blank javascript but made a mistake by not adding a period after the asterisks:
@echo off
break>"%~dp0\new.txt"
ren *txt *js
The result was a file labelled new.txtjs. What exactly did my rename command do when I omitted the period?
Upvotes: 1
Views: 39
Reputation: 73836
ren
command isn't a "string replace" function.
The period in the new file name anchors the position of the following text to the extension, which is everything after the last period, and thus the extension would be replaced with the provided text.
Omitting the period makes *
in *js
consume all characters of the name and then append js
.
Upvotes: 3