The Volume Shadow Copy Service (VSS) can be used to mount a copy of a drive in a crash consistent state (like you just unplugged your computer) as a different drive letter. My shadow task command line tool makes it easy to do this. Here's an example:
ShadowTask64 C V test.bat
This creates a shadow copy of the C: drive, mounts it as V: and then runs test.bat. When test.bat completes the shadow V: drive is removed.
What can you do with this?
The simple case is grabbing a copy of a locked file. In this case test.bat could just run pause and then grab the file you need from V:.
It's also a great way to run a backup. In this case the batch file can run XCOPY (to a network share or portable drive) and you'll get all your files including anything locked like running executables or Outlook PST files.
Grab the latest from GitHub: abfo/shadow/releases. You'll find a ZIP file and source code if you want to use/extend this. There are 32 and 64-bit binaries - you need to use the right one for your computer and you also need to run the tool with administrative privileges. This only works with NTFS drives.
- Do useful things with the volume shadow copy service (VSS)
- WiX Tricks for Screen Savers
- Folder Insights
You Might Also Like
Hi Rafal, thanks for the feedback. I'm glad you find it useful. For #1 a workaround is to call a dummy batch file (i.e. pause or set) that will keep the shadow volume around for as long as you need. For #2 I think this is an autoplay setting that you could change in Windows. The next time I update it I'll look at the permanent mount option, can't say when though. Hope this helps.
This is a great and pretty usefull tool. It would be even better if the author kindly considered the following enhancements:
1. add permanent mount and unmount switch - e.g. if I call the program with /p switch , the shadow copy volume stays permanent so is not unmounted after the program ends (then I can run the stuff not doable via bat file). When I run it again with an /u switch, the shadow copy volume is unmounted.
2. a switch to suppress Explorer from openning the newly mounted volume - so when I use the program in the batch mode it stays in the background as expected.
other than this- all the best for 2023!