The command where return listing the full path of the files, capture this output in a for to rename the extension.
An option of a looping for with the where recursive=/r for rename as extension
:: No arquivo bat/cmd ::
@echo off
for /f "tokens=*" %&i in ('where /r "D:\Download" "*.rar"')do rename "%%~i" "%%~ni.cbr"
:: Na linha de comando ::
for /f "tokens=*" %i in ('where /r "D:\Download" "*.rar"')do @rename "%~i" "%~ni.cbr"
1. Try to get the way and name of filing cabinet target in a For using /F + Dir /S...
2. In charge CD add /D (enters and remains in the Drive and Directory running the commands on Drive and Directory pointed in command.
On the command line:
CD /D D:\Downloads\
For /F "tokens=*" %i in ('^<nul dir /o-d /on /b /S "*.rar"')do rename "%~i" "%~ni.cbr"
In the bat/cmd file:
CD /D D:\Downloads\
For /f "tokens=*" %%i in ('^<nul Dir /o-d /on /b /S "*.rar"')do rename "%%~i" "%%~ni.cbr"