Results 1 to 4 of 4

Thread: Batch file problem

  1. #1
    Join Date
    Jul 2006
    Posts
    139
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default Batch file problem

    OK here is another problem. I can map the x drive but the h drive depends on different users. in this line (if you see at the bottom)

    net use h: \\home\String$ /persistent:Yes

    the user knows the value of 'String' and it is different for each. Whoever runs the file will have to input the 'String' and the batch file will save it so it wont ask for the string anymore. Can this be done?

    Batch File Code:
    ------------------------------------------------------------------
    rem this file will remove all current drive mappings on the respective
    rem drive letter then remap the connections

    @echo off

    cls
    echo.
    echo If you are using this from home
    echo.
    cls

    c:
    cd\windows\system32

    rem delete all the drives potentially in use
    net use h: /d
    net use x: /d


    rem remap the drives

    net use h: \\home\String$ /persistent:Yes
    net use x: \\aaaa\abcd$ /persistent:Yes

  2. #2
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    set /p store=Enter String:
    echo.%store%
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  3. #3
    Join Date
    Jul 2006
    Posts
    139
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    so would it be like this?

    rem this file will remove all current drive mappings on the respective
    rem drive letter then remap the connections

    @echo off

    cls
    echo.
    echo If you are using this from home
    set /p store=Enter String:
    echo.%store%
    echo.
    cls

    c:
    cd\windows\system32

    rem delete all the drives potentially in use
    net use h: /d


    rem remap the drives

    net use h: \\iuph\p$ /persistent:Yes (***where p is referencing the stored string***)

  4. #4
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Not p$, %store%
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

Bookmarks

Posting Permissions

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