Software >> OS >> Windows >> Command Line >> How to rename files matching a pattern

eg files x_y_z.txt to rename to *.txt on command line: FOR /F "usebackq tokens=1,2* delims=_" %i in (`DIR /B allpostersdata\*.TXT`) do move allpostersdata\ %i_%j_%k allpostersrenamed\%i.txt on batch files: FOR /F "usebackq tokens=1,2* delims=_" %%i in (`DIR /B allpostersdata\*.TXT`) do move allpostersdata\ %%i_%%j_%%k allpostersrenamed\%%i.txt