How do I change a file name with es.exe?

General discussion related to "Everything".
Post Reply
wu_yi
Posts: 10
Joined: Sun Dec 26, 2021 2:16 am

How do I change a file name with es.exe?

Post by wu_yi »

I want to find foo.txt and rename it to bar.txt. How do I do that with es.exe?
void
Developer
Posts: 16753
Joined: Fri Oct 16, 2009 11:31 pm

Re: How do I change a file name with es.exe?

Post by void »

Code: Select all

for /f %A in ('es -n 1 foo.txt') do set esfile=%A
rename %esfile% bar.txt
This will find the first match of foo.txt and rename it to bar.txt

If you would like to do this from a BAT file, use:
esrn.bat

Code: Select all

for /f %%A in ('es -n 1 %1') do set esfile=%%A
rename %esfile% %2
then call:
esrn foo.txt bar.txt



I recommend searching for foo.txt with:
es foo.txt
and manually renaming the desired result with:
rename <old-filename> <new-filename>
Post Reply