This is the code I have so far:
@echo off
set /P suffix=Enter name to add:
@echo off
setlocal EnableDelayedExpansion
PUSHD .
cd "%%d"
set n=0
for %%f in (*.*) do (
set /A n+=1
set "file[!n!]=%%f"
)
set /A "rand=(n*%random%)/32768+1"
copy "!file[%rand%]!" "%suffix%"
POPD
Progress: I have the functions of taking user input, selecting a single random file and copying it and pasting it with a new name.
Problems: It doesn't apply to subfolders, the user input isn't added as a suffix but literally renames the entire file.
Question: How can I add the user input as a suffix to a newly copied file while retaining the filename and filetype?
And is it possible to apply this function to subfolders as well?