Note: There is no need to use batch per say, but I am just familiar with batch, Powershell would be better I imagine, so if there are easier solutions for this problem in powershell, please shout!

I have the arduous task of testing our DR backups for all our clients, that is, mounting ShadowProtect Snapshots latest incremental, writing and reading a file, them unmounting the image. The actual ShadowProtect part of batch is fairly simple but I would like to design a batch that can automate this.

Essentially my question is:

How in a batch file can I firstly, enumerate files in a folder, and then place a specific part of a given filename into a variable?

Reason being ShadowProtect incrementals have a naming convention such like: