Part of this answer references GPT and GPT_Pro to solve the problem better.
This may be due to security Settings. First make sure the account has administrator permissions to handle network sharing Settings; Next, open the Control Panel, go to Network and Internet/ Network and Sharing Center, and select Change Advanced Sharing Settings; Next, under File and Print sharing, check Enable file and print sharing, then uncheck Use Secure Connection(SSL); Finally, restart your computer again and you can see that "Enable File and Print sharing" is in effect.
In addition, if you want to change the registry, you can also try modifying the registry to set it up with the following code:
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /v AutoShareServer /t REG_DWORD /d 0x1 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /v AutoShareWks /t REG_DWORD /d 0x1 /f
The above code can set up file and print sharing on Windows 10.
If the answer is helpful, please accept it.