Q:

How to delete all files in parent folder with same file name as in a specified subfolder?

I am new to batch file writing.
This is the current content of parent folder Folder1:
C:\Folder1\Subfolder1
C:\Folder1\Afile001.txt
C:\Folder1\Bfile002.txt
C:\Folder1\Cfile003.txt
C:\Folder1\Xfile004.txt
C:\Folder1\Yfile005.txt

The number of files increases from time to time in this folder.
I need the current list of files from Folder1 and then copy them to Subfolder1 which is achieved by using command copy *.txt Subfolder1.
Next the files in Subfolder1 are taken (or copied) by some process and then contents of parent Folder1 changes to:
C:\Folder1\Subfolder1
C:\Folder1\Afile001.txt
C:\Folder1\Bfile002.txt
C:\Folder1\Cfile003.txt
C:\Folder1\Xfile004.txt
C:\Folder1\Yfile005.txt
C:\Folder1\Dfile001.txt
C:\Folder1\Efile002.txt
C:\Folder1\Ffile003.txt
C:\Folder1\Gfile004.txt
C:\Folder1\Hfile005.txt

How can I achieve a batch file which takes the list of files from Subfolder1 and use that list to delete the files with same name from Folder1 and leaves behind only the new files in that folder?
So the result should be for Folder1:
C:\Folder1\Subfolder1
C:\Folder1\Dfile001.txt
C:\Folder1\Efile002.txt
C:\Folder1\Ffile003.txt
C:\Folder1\Gfile004.txt
C:\Folder1\Hfile005.txt

A:

That can be done with just a single command line using the commands FOR and DEL:
@echo off
for %%I in ("C:\Folder1\Subfolder1\*.txt") do del "C:\Folder1\%%~nxI" 2>nul

For understanding the used commands and how they work, open a command prompt window, execute there the following commands, and read entirely all help pages displayed for each command very carefully.

del /?
echo /?
for /?

Read also the Microsoft article about Using Command Redirection Operators for an explanation of 2>nul to suppress the error message output by DEL to handle STDERR with redirection to device NUL in case of a *.txt file in C:\Folder1\Subfolder1 does not exist anymore in C:\Folder1.
By the way: It would be also possible to use the command
move /Y C:\Folder1\*.txt C:\Folder1\Subfolder1\

to move the files from C:\Folder1 to C:\Folder1\Subfolder1 instead of copying them first and later deleting them.

