Page 1 of 2
script to set folder shares
Posted: 15 May 2013 17:19
by calude
Hi
a script that would be very useful for me
the script would set a fixed group of folders to "Share with Homegroup read and write"
Have a nice day
calude
Re: script to set folder shares
Posted: 15 May 2013 18:01
by binocular222
Re: script to set folder shares
Posted: 16 May 2013 14:58
by calude
thanks binocular222
I tried to understand the use of your script. seems too complicated for my simple needs
on my office PC I have a crypted partition that I first have to mount before I can do something with it.
the problem is this partition doesnt remember its shared folders.
hence the script to set the share on a max of 10, always the same folders.
anyone ?
Calude
Re: script to set folder shares
Posted: 19 May 2013 17:21
by calude
nobody has a clue to help me ?
come on
;=)
Calude
Re: script to set folder shares
Posted: 19 May 2013 18:05
by binocular222
Your system is too unique.
Mount an encrypted drive at start-up then share a secific folder on it? Uhm, I have no such system to test on
Re: script to set folder shares
Posted: 19 May 2013 18:50
by calude
hi binocular222
the only part I need is set some folders to share with homegroup with a script
Calude
Re: script to set folder shares
Posted: 19 May 2013 19:53
by serendipity
If you are OK doing that with command line, using
net share command like this for eg.:
Code: Select all
NET SHARE MyVids="D:\Videos" /GRANT:Everyone,FULL
This will share a particular folder with everyone and grant them full access.
If something like this works for you, then you can call that command line from within the XY script.
More info in NET SHARE:
http://ss64.com/nt/net_share.html
Re: script to set folder shares
Posted: 20 May 2013 03:55
by binocular222
My script use exactly this Net Share, but as calude described, when the encrypted drive is mounted on computer start-up, all shared information is lost, he has to share them again.
Maybe callude should add /script= to run the script at every Xyplorer start-up?
Re: script to set folder shares
Posted: 20 May 2013 04:07
by serendipity
binocular222 wrote:My script use exactly this Net Share, but as calude described, when the encrypted drive is mounted on computer start-up, all shared information is lost, he has to share them again.
Maybe callude should add /script= to run the script at every Xyplorer start-up?
Oh sorry, did not see your script. Yes, running script at start would be the way to do it then.
Re: script to set folder shares
Posted: 20 May 2013 09:42
by calude
I'm sorry, I'm really not computer literate "enough"

!!
to write this myself with the fine xy manual
tried to send some "NET SHARE sharename" with xy "run " didnt get a window back
will kindly ask for some more "code" help, and of course, running script at start could be an option, when the global script does it magic!
binocular and serendipity thanks
Calude
Re: script to set folder shares
Posted: 20 May 2013 10:29
by binocular222
The command-line is basically:
Net share "Name-to-Display"="Folder Path" /Grant:Everyone,Full
Here is the simple script:
Code: Select all
run "cmd /c Net share ""Test 1""=""C:\Test 1"" /Grant:Everyone,Full";
run "cmd /c Net share ""Test 2""=""C:\Test 2"" /Grant:Everyone,Full";
run "cmd /c Net share ""Test 3""=""C:\Test 3"" /Grant:Everyone,Full";
wait 500;
#482;
#486;
Step 1: You may need to increase/decrease wait depend on how much time your computer need to run all your Net share command (in my code, after completion of all 3 Net share, XYplorer will wait 500mili second and refresh)
Step 2: You save the code in \XYplorer\Data\Scripts\ with Sharingscript.xys
Step 3: You create a shortcut to XYplorer.exe, right click the newly created shortcut → properties → paste argument in Target field such as this:
E:\7Utilities\XYplorer\XYplorer.exe /script="Sharingscript.xys"
Now, everytime you double click the shortcut, the script will be executed, which shares all these folders.
I don't know if share those folders multiples times without unshare them will create any trouble. You may go to %net% to check for any weird things after several times running this script
Note: If this works, and you don't want black screen flashing, then you may use Nircmd such as:
run """E:\7Utilities\XYplorer\Data\Scripts\nircmd\nircmd.exe"" execmd Net share ""Test 3""=""C:\Test 3"" /Grant:Everyone,Full";
P.S: This script allow other computers to see and access folders on your computer but what's Home Group? I don't have one, so cannot say if it works.
Re: script to set folder shares
Posted: 21 May 2013 10:22
by calude
Hi
I tried the script but nothing happens on the test folders
I maybe must add that I'm running Win 7 32 and homeGroup i this:
http://windows.microsoft.com/en-us/wind ... /homegroup
Calude
Re: script to set folder shares
Posted: 21 May 2013 17:44
by binocular222
Try Start → Run → cmd
and type in this command:
cmd Net share "Test 3"="C:\Test 3" /Grant:Everyone,Full
Will this change the sharing status of Test 3 folder? (right click → share with → advanced sharing)
My scipt does exactly this.
P.S I'm running win 7 x32 too
Re: script to set folder shares
Posted: 21 May 2013 17:59
by calude
binocular222 wrote:Try Start → Run → cmd
and type in this command:
cmd Net share "Test 3"="C:\Test 3" /Grant:Everyone,Full
Will this change the sharing status of Test 3 folder? (right click → share with → advanced sharing)
My scipt does exactly this.
P.S I'm running win 7 x32 too
My test folder is test3 on D: so I changed the command to
cmd Net share "test3"="D:\test3" /Grant:Everyone,Full
nothing happens
the swiss french locale should'nt be different ??
Calude
Re: script to set folder shares
Posted: 21 May 2013 18:05
by binocular222
oh sorry, it should be
Net share "test3"="D:\test3" /Grant:Everyone,Full
the "cmd" in the beginning is redundant.