Share Folders With Windows Homegroup Through Command Line / Batch File

If you have a folder


and you would like to share it with your Windows Homegroup, you can do so in the Windows Command line (cmd.exe) or in a Batch file with the net share tool.

The folder above could be shared with the name "Test" as follows:

net share Test="C:\Test" /GRANT:"HomeUsers",FULL