How do I copy a file or folder that is locked under windows programmatically?

前端 未结 3 1647
遇见更好的自我
遇见更好的自我 2021-01-04 07:55

What are the API calls to copy a file that is currently locked. I\'m hoping to be able to use .Net, but Win32 calls would be fine as well.

Please feel free to chi

3条回答
  •  情话喂你
    2021-01-04 08:29

    Almost the same as my answer to another question:

    If you are on Win32, the official way to do it is to mark it to be moved on reboot, and ask the user to reboot. To mark the file to be moved on reboot, use MoveFileEx with the MOVEFILE_DELAY_UNTIL_REBOOT flag.

    It's the same function, only this time you don't pass NULL as the destination.

提交回复
热议问题