No announcement yet.

Mapping a drive

  • Filter
  • Time
  • Show
Clear All
new posts

  • Mapping a drive

    I'm running some PB code on a server that uses winrar to compress and uses to copy files. In order for this to work, I need to have a drive mapped.
    The code runs great when I am remotely connected, but, by itself, via windows NT scheduler, it doesn't have access to the mapped drive.

    Is there a way within PB to map a drive?

  • #2
    Net Use ??

    If you want to stay away from the API just SHELL to NET USE.

    There are options to make it persistent (stays at next log on) or temporary only for the current session.

    Type NET HELP USE from a command prompt to see the options.

    A place to start.
    Mark Strickland, CISSP, CEH


    • #3
      > uses to copy files

      Change to CopyFile[Ex] (WinAPI) or FILECOPY (PB) and you can use UNC name and don't have to map a drive.

      Otherwise, I think the WnetXXXXX functions do what you want. Take a look at WNetAddconnection and WnetUseConnection

      Or, use one of these I found in my SDK:
      The following code maps the logical drive "E" to a network share with the UNC name "\\Server\Public."
      Dim WshNetwork
      Set WshNetwork = WScript.CreateObject("WScript.Network")
      WshNetwork.MapNetworkDrive "E:", "\\Server\Public"
      var WshNetwork = WScript.CreateObject("WScript.Network");
      WshNetwork.MapNetworkDrive ("E:", "\\\\Server\\Public");
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]


      • #4
        Not sure about scheduler now but under the old AT command neither or were given the security rights to copy files across a network