Need help on create a batch file
Results 1 to 7 of 7

Thread: Need help on create a batch file

  1. #1
    Junior Member
    Join Date
    Jun 2010
    Posts
    3

    Exclamation Need help on create a batch file

    Hi everyone,

    I have a lab practices about using scripts that I need help on.

    Contoso has 20 seperate locations in the United States, and each location is being equipped with a new file server. The file servers are going to have six shared folders, which will have the same names regardless of location. You need to create a batch file that automatically creates these six shares. Once the shares are created, on-site technicians will set the permissions manually according to their needs.

    To complete thsi lab challenge, do the following:

    1. Write a batch file named SharedFolders.bat that uses the Net Share command to share the following folders. The share name and folder name should be the same, and the folders should be located in C:\Standard Shares\
    - Financial
    - Marketing
    - Support
    - Miscellaneous
    - Legal
    - Customer Support

    2. Run the batch file
    3. Verify that your partnet has successfully run the batch file by accessing the shared folders on your partner's computer from a Run dialog box

    This is from Microsoft Windows XP Pro lab manual, I've never did batch file before. I would like some help on it.

    Thanks.

  2. #2
    Junior Member
    Join Date
    Jun 2010
    Posts
    3
    I wrote this and its work, first it work for the 6-subfolder inside "Standard Shares" but it doesn't work on Standard Shares. After awhile, I delete the batch file and create a new batch file and it work for all 7-folders.

    cd\
    md "C:\Standard Shares"
    cd "Standard Shares"
    md Financial
    md Marketing
    md Support
    md Miscellaneous
    md Legal
    md "Customer Support"
    cd\
    net share "Standard Shares"="C:\Standard Shares"
    net share Financial="C:\Standard Shares\Financial"
    net share Marketing="C:\Standard Shares\Marketing"
    net share Support="C:\Standard Shares\Support"
    net share Miscellaneous="C:\Standard Shares\Miscellaneous"
    net share Legal="C:\Standard Shares\Legal"
    net share "Customer Support"="C:\Standard Shares\Customer Support"
    cd\

    thx,

  3. #3
    THE Bastard Sys***** dinowuff's Avatar
    Join Date
    Jun 2003
    Location
    Third planet from the Sun
    Posts
    1,250
    Really? That works... WOW. And who deleted my previous post?
    09:F9:11:02:9D:74:E3:5B8:41:56:C5:63:56:88:C0

  4. #4
    Gonzo District BOFH westin's Avatar
    Join Date
    Jan 2006
    Location
    SW MO
    Posts
    1,188
    Quote Originally Posted by hacmiu View Post
    I wrote this and its work, first it work for the 6-subfolder inside "Standard Shares" but it doesn't work on Standard Shares. After awhile, I delete the batch file and create a new batch file and it work for all 7-folders.
    Ok, I might be misunderstanding your issue here. Are you saying that the subfolders inside 'C:\Standard Shares' are shared properly, but that the 'Standard Shares' share is not working? [I might have just confused myself further with this post! ]

    Either way, welcome to AO!
    \"Those of us that had been up all night were in no mood for coffee and donuts, we wanted strong drink.\"

    -HST

  5. #5
    THE Bastard Sys***** dinowuff's Avatar
    Join Date
    Jun 2003
    Location
    Third planet from the Sun
    Posts
    1,250
    net share "Standard Shares"="C:\Standard Shares"

    Syntax is incorrect and command is incomplete

    I was being a smart ass... The bat file above does not share the folders.
    09:F9:11:02:9D:74:E3:5B8:41:56:C5:63:56:88:C0

  6. #6
    Junior Member
    Join Date
    Jun 2010
    Posts
    3
    the "Standard Shares" does not share when I first created, the folder shared when I edit

    cd\
    md "C:\Standard Shares"
    cd Standard Shares" (leave the open quote out)
    md Financial
    ...

    and the other way that I did was copy the whole thing to a new ".bat" and it work (on first attempt)

  7. #7
    Senior Member
    Join Date
    Jul 2002
    Posts
    744
    reduced to batches, nao? wtf? I don't even? EI rly brought this place down.

    GIVE BACK TO JP...also, bring back snacks.
    Every now and then, one of you won't annoy me.

Similar Threads

  1. Basic Hosts File Banner Ad-Blocking Tutorial
    By xierox in forum Other Tutorials Forum
    Replies: 0
    Last Post: March 5th, 2005, 04:34 AM
  2. Newbies Guide to Batch Programming
    By Deimos326 in forum Other Tutorials Forum
    Replies: 3
    Last Post: December 7th, 2003, 10:18 PM
  3. Batch programing (Tips and Tricks)
    By ele5125 in forum Other Tutorials Forum
    Replies: 9
    Last Post: June 19th, 2002, 05:09 PM
  4. Test Your General Linux Knowledge
    By smirc in forum AntiOnline's General Chit Chat
    Replies: 6
    Last Post: May 13th, 2002, 04:35 PM
  5. Batch File Tut
    By Badassatchu in forum Non-Security Archives
    Replies: 1
    Last Post: November 23rd, 2001, 10:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 Security News

     Patches

       Security Trends

         How-To

           Buying Guides