I need a batch that will delete files from a LAN, all the paths of the files being saved in a txt file. Don’t know how the batch will “read” the paths then delete those files with DEL command.
The line that works so far is:
del "path\*.txt" – for deletion of all txt in some folder (path being the actual line, like c:\folder\folder\*.txt), but I need for a lot more paths.
i pushed then the batch with psexec.exe (for the LAN deletion)
I guess it’s 2-3 lines of code, but I’m new to batching & scripting, could someone pls help! Thanks in advance
You can use the
FOR /Fcommand to process each line in your input file. Here is a SO answer: How do you loop through each line in a text file using a windows batch file?This just worked for me (the parentheses around the file name are necessary):
myfile.txtlooks like this: