Yes, you can disconnect a user or all users from a shared folder or drive by using a command line.
-open an elevated Command Prompt
Type:
net session \<computer> /delete
For example, to disconnect a user on a computer named user_computer, which is connected to a shared folder that you are managing, type:
net session \user_computer /delete
Hope this resolves your Query!!
--
--If the reply is helpful, please Upvote and Accept it as an answer–