Announcement

Collapse
No announcement yet.

Mapping a drive

Collapse
X
 
  • 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 command.com 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
    SimplyBASICsecurity.com

    Comment


    • #3
      > uses command.com 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:
      Example
      The following code maps the logical drive "E" to a network share with the UNC name "\\Server\Public."
      Code:
      [VBScript] 
      Dim WshNetwork
      Set WshNetwork = WScript.CreateObject("WScript.Network")
      WshNetwork.MapNetworkDrive "E:", "\\Server\Public"
      [JScript] 
      var WshNetwork = WScript.CreateObject("WScript.Network");
      WshNetwork.MapNetworkDrive ("E:", "\\\\Server\\Public");
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


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

        Comment

        Working...
        X