Using Windows command prompt, I want to unlock and delete several files in a single command if possible. So far I have managed to come up with:
net file | findstr /R [0-9]*lock
This results in:
12345 C:\MyProgram\0001.lock user.name 0 12346 C:\MyProgram\0002.lock user.name 0 12347 C:\MyProgram\0003.lock user.name 0 12348 C:\MyProgram\0004.lock user.name 0 12349 C:\MyProgram\0005.lock user.name 0
The first part of the string (ID) would be used as follows:
net file 12345 /close
The second part of the string (path) would be used as follows:
I would like to put this into a batch script, which would cycle through each line ouputted by findstr, grab the 1st and 2nd parts and execute the commands accordingly. Any help would be greatly appreciated.