Batch creates a batch code for a full, read-only shared folder

Time:2020-2-11
Copy codeThe code is as follows:
:: create share:
Net share MP3 $= D: \ MP3 / Unlimited / remark: “this is a full share” / cache: no
Net share MP4 $= D: \ MP4 / users: 10 / remark: “this is also a full share. To set read-only, please adjust permissions yourself” / cache: no
:: the share is divided into read-only and full share. The default is full share. I can’t find the parameter to set the share permission,
:: you can set permissions manually. If you have to use batch processing, use cacls instead,
@echo y|cacls d:\mp3 /c /p everyone:r administrators:f system:f “network service”:f>nul
@echo y|cacls d:\mp3\*.* /c /p everyone:r administrators:f system:f “network service”:f>nul

:: View share:
net share mp3$
net share mp4$
:: delete with net share MP3 $/ delete
net share mp4$ /delete

pause

Explain one more sentence,
Net share MP3 $= D: \ MP3 / Unlimited / remark: “this is a full share” / cache: no
It means to share D: \ MP3. The share name is MP3 $/ unlimited, which is used more in the server, that is, the number of connections is not limited,
Conversely, if you want to limit the number of connections, use / users: 8 to limit the maximum number of simultaneous connections to 8 computers.
/Remark is the explanation, / cache: no does not need to be cached offline.