Q:

Batch File rename in folder and subfolders adding current dir as prefix to filenames

I would like to have a windows batch file which gives prefix to all files on the same level where the batch file is and all files in the sub folders. The prefix would be the folder name which contains the batch file. I have a working code, but it only rename the docx files at the same folder level.
@echo off
for %%* in (.) do set CurrDirName1=%%~n*
FOR /f "delims=" %%F IN ('DIR /a-d /b *.docx')  DO (RENAME "%%F" "%CurrDirName1%-%%F")

A:

...you are near. Add /s parameter to dir to include subdirectories and use ~nx modifier for filename + extension for the rename command (%%F would be including the path and rename doesn't like that for the destination (needs filename.extension only)).
FOR /f "delims=" %%F IN ('DIR /s /a-d /b *.docx')  DO (RENAME "%%F" "%CurrDirName1%-%%~nxF")

