Welcome HOME to SatelliteGuys! We are America's Most Popular Satellite Forum!

        

Results 1 to 6 of 6

Thread: Mapping network drive using bat file

  1. #1
    Join Date
    May 20th, 2004
    Location
    Manhattan, KS
    Posts
    692
    Post Thanks / Like

    Mapping network drive using bat file

    No problems mapping a network drive using a .bat file, but I cannot figure out for the life of me how to get the bat file to map to a folder in the share. I have a share called software and 20 folder in it called Lab 1 all the way to Lab 20

    for example:
    I do map network drives

    \\IP.IP.IP.IP\software\Lab 14

    and it works great, but trying to do that in a bat file, nothing happens

    \\IP.IP.IP.IP\software

    works great in the bat file.

    Anyone know how to get directly to that Lab 14 folder using a bat file?


  2. # ADS
    Register Today & This Ad Goes Away! Syndicated Advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

    Reigster at SatelliteGuys
     
  3. #2
    Help Keep SatelliteGuys For All, Click a Star and Become a Supporter! SatinKzo did! Help Support The Site And Get Rid of the Syndicated Ads, SatinKzo did! If you enjoy the site consider supporting it, SatinKzo did! Be COOL like SatinKzo and Click a Star and become a Supporting Pub Member today!
    Join Date
    May 22nd, 2004
    Location
    ArkLaMiss
    Posts
    5,985
    Post Thanks / Like
    net use x: \\ip.ip.ip.ip\share
    x: being the desired drive letter to assign.

    You can also delete the mapping

    net use x: /delete
    or
    net use x: /delete /y
    to delete and answer yes if a message requiring confirmation comes up.

    There are other more exotic ways to do it with different scripting languages.
    The angels have the phone box.

  4. #3
    Join Date
    May 20th, 2004
    Location
    Manhattan, KS
    Posts
    692
    Post Thanks / Like
    Thread Starter
    Got that, just cannot get the folder under the share to map using a bat file....

    but it maps fine using the Map Network drive tool

  5. #4
    Help Keep SatelliteGuys For All, Click a Star and Become a Supporter! SatinKzo did! Help Support The Site And Get Rid of the Syndicated Ads, SatinKzo did! If you enjoy the site consider supporting it, SatinKzo did! Be COOL like SatinKzo and Click a Star and become a Supporting Pub Member today!
    Join Date
    May 22nd, 2004
    Location
    ArkLaMiss
    Posts
    5,985
    Post Thanks / Like
    Should work fine even with a sub-dir of the shared directory

    example:

    net use x: \\ip.ip.ip.ip\share\subdir

    Just tested quicky and it works fine for me. What OS are we talking here? I assumed windows.

    If you wanted to get real fancy you could put a loop or similar in the batch file and map all 20 lab directories with just a couple lines in the batch file.
    Edit:
    OH, wait, do your lab directories look like this?

    Lab 14
    not
    Lab14
    ?

    The space is getting ya. Try this

    net use x: "\\ip.ip.ip.ip\share\subdir stuff"
    The angels have the phone box.

  6. #5
    Join Date
    May 20th, 2004
    Location
    Manhattan, KS
    Posts
    692
    Post Thanks / Like
    Thread Starter
    PERFECT!!!! Didn't eve consider the space messing me up.

    THANKS SO MUCH!!!!!!!!

  7. #6
    Join Date
    Nov 28th, 2008
    Posts
    1
    Post Thanks / Like

    even better

    Set oShell = Createobject("wscript.shell") <enter>
    Set oNet = CreateObject("Wscript.Network") <enter>
    oNet.MapNetworkDrive "v:", "
    \name


    of computer\name of share", True, "username", "password" <enter>
    if same computer copy line to \name of share"
    if new computer drive type the full line and username and password

    this will allow you to map network drives with different user names and passwords and you can customize it to fit as many shares as needed


Tags for this Thread

Posting Permissions

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