Need solution automate setting a share


  1. Posts : 69
    Wind7 64 x 3 | Win Vista 32 | Ubunto
       #1

    Need solution automate setting a share


    Good day!


    Was wondering if anyone knows of a way to write a batch file to set up a network share on a drive with a single click.


    I have an encrypted container for bookkeeping and financial stuff that when mounted, needs to be accessible from another computer on LAN.


    Any settings for a share are, of course, lost on dismount so each time I have to go to the drive/sharing/advanced sharing. There I remove "everyone" and replace with "NETWORK" will all permissions.


    I'm lazy.


    I would love to have a batch file, script that when clicked after mounting said drive will apply all the necessary share settings for me on the specific drive letter I always assign to that drive.


    Anyone know if or how this can be done?


    Thanks much.
      My Computer


  2. Posts : 3,785
    win 8 32 bit
       #2

    You won't loose the share if you use persistent switch
      My Computer


  3. Posts : 2,246
    Windows 7 Pro SP1 64 bit
       #3

    If you go to the Control Panel, Network and Sharing, do you have File Sharing enabled? That should be done on the computer which defines the Network.
      My Computer


  4. Posts : 69
    Wind7 64 x 3 | Win Vista 32 | Ubunto
    Thread Starter
       #4

    Sounds like a way to get to where I want to go. Yes sharing is on by default so it is obvious there needs to be more than that to "remember" a drive letter that is not always there which is why I was thinking I might need a batch file or something to apply the share after mounting the volume.


    If either of the replies can provide more info on how to accomplish this please let me know.


    Thanks
      My Computer


  5. Posts : 2,246
    Windows 7 Pro SP1 64 bit
       #5

    I'm going to leave this one to samuria. I found this-

    Net Use Command (Examples, Options, Switches, and More)

    but have no idea if that is going to help you.
      My Computer


  6. Posts : 69
    Wind7 64 x 3 | Win Vista 32 | Ubunto
    Thread Starter
       #6

    Still confused :)🚻


    wither 2 said:
    I'm going to leave this one to samuria. I found this-

    Net Use Command (Examples, Options, Switches, and More)

    but have no idea if that is going to help you.

    Now I am even more confused! I guess Im too dumb to figure it out so will stick with the old way for now!
      My Computer


  7. Posts : 3,785
    win 8 32 bit
       #7

    Just use
    net use * "\\server\my media" /persistent:yes
      My Computer


  8. Posts : 1,363
    Win7 pro x64
       #8

    samuria said:
    Just use
    net use * "\\server\my media" /persistent:yes
    you create a file called share.cmd and put it on your desktop. It has to be a .cmd file, not .txt, not .doc. Put only one line in it, for instance the line samuria has above. Then when you click on the share.cmd file, the line gets executed.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 06:44.
Find Us