I am trying to write a script to get all the file names in a folder without the extension. And then from that txt file with all names I want to copy each file with that name in a folder anywhere. So folder B would have all the files I need with .pdf on it and I want to get the .doc file from folder A with the corresponding name as B
Example Folder B = 123.doc.pdf, 234.doc.pdf, 345.doc.pdf
Folder A = 123.doc, 234.doc, 345.doc, 1324.doc, 54353.doc, 1231.doc
I want to get the names from B without the .pdf and then use that txt file to copy the doc files from folder A in a new folder C.
I created a script to get all file names but not sure how to remove the extension and safe it to the file.
dir /a /b /-p /o:gen >FileNames.txt
Anyone can help?