If I reboot windows while a third-party process has a file locked, will the lock be automatically released?

By third-party, I mean any non-windows process, such as my software or another vendors software.

If so, is it 100% or depends?

  • Can you define 3rd party? Something accessing it via the network?
    – Jarmund
    May 22, 2015 at 21:57
  • The process will be shutdown before windows restarts so, yeah, the file lock is released
    – Ramhound
    May 22, 2015 at 22:32
  • Locks are held in memory while the OS is running, not by flagging the files on disk in any way. So all locks owned nyba process are automatically released when that process quits. May 23, 2015 at 7:27
  • @Colin'tHart so, if computer A has a file locked on remote computer B's drive, and I pull the plug (power outage) on A, when will the lock on B's drive be released? May 23, 2015 at 9:07
  • @Colin'tHart File locking on Windows goes all the way back to this, and is still compatible with this: vfrazee.com/ms-dos/6.22/help/share.htm May 23, 2015 at 9:11

2 Answers 2


Yes. Windows gives each program WaitToKillAppTimeout seconds to shutdown (default is 20): https://technet.microsoft.com/en-us/library/cc978624.aspx

After it, it closes all programs. All files are released, file handlers become invalid and Windows shuts down.


First of all, yes, as per the answer provided by @user996142

To elaborate on my comment regarding network processes, the answer is "eventually, yes". Anything accessing your files via the network is actually locking the file indirectly. The host process on your machine (for example, whatever process is behind the SMB sharing) does the actual file locking. If something is accessing this file, and you force a hibernate or suspend, when you resume it will still be locked until the SMB process notices that the client is not connected anymore, and release the lock. I am not sure of the timeframe here, but microsoft seems to like timeout defaults of 2 minutes.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .