I'm trying to create a batch file that deletes all files from the desktop that have the same name as those in a specific folder (C:\Users\micheled\Desktop\TestDelete)
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
FOR %%x IN (*) DO (
del C:\Users\micheled\Desktop\%%x
)
but I have a problem with files that have a space in the name (example: "w 2.txt), the batch instead of performing delete w 2.txt executes: delete w delete 2.txt so how do I make sure that the files with the sweep are considered a single element?
Thanks in advance!