change path if current path meets criteria

Discussion in 'Scripting' started by tjcooper, Jun 25, 2004.

  1. tjcooper

    tjcooper Guest

    So far, I can check to see if a drive exist, disconnect it if it does, and remap it.

    However, Ideally I would like to use the drive object to pull information about a specific drive (K), test for the path, and if it matches, disconnect it and remap it.

    I know the Drive Object returns the path value; however, I do not know how to merge the two scripts (one using drive object and the other mapping a drive).
     
    tjcooper, Jun 25, 2004
    #1
    1. Advertisements

  2. tjcooper

    tjcooper Guest

    Hers what I came up with...it doesnt work.

    Dim fs
    Dim drv
    Dim wn

    Set fs = CreateObject("Scripting.FileSystemObject")
    Set drv = fs.GetDrive("K")

    If drv.Path = "\\pearl\projects" Then
    Set wn = WScript.CreateObject("WScript.Network")
    wn.RemoveNetworkDrive "K:", true, true
    wn.MapNetworkDrive "K:", "\\Dotscflykhq01p\Public"
    End If

    Set fs = Nothing
    Set drv = Nothing
    Set win = nothing
     
    tjcooper, Jun 25, 2004
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.