How to map network drive using .bat file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • matt753
    New Member
    • May 2010
    • 91

    How to map network drive using .bat file

    I want to create a .bat file (or any other type of file where I can have the user one-click) to map a network drive.

    Right now I can open the command prompt and type:
    Code:
    net use Z: \\server\foldername\ employee
    ("employee" is the password)

    Which mostly solves the problems I was having before when I mapped the network drive through tools -> map network drive, the password prompt would always show up after a reboot.

    I just want to be able to click the bat file and have that code execute as most users cannot do this themself.

    Thanks
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32657

    #2
    I'd use a .CMD file nowadays, and basically use the NET USE command very much as you have done. Type NET USE /? from a command line to get the full spec of that command.

    As you are this far already can you say what more you need than you've shown you already understand?

    Comment

    • matt753
      New Member
      • May 2010
      • 91

      #3
      How do I make a .cmd file? Just notepad that 'net use' text then save it as the extension .cmd?

      I know how to do it from the command line I just need to make a one-click file for other users to do this.

      Thanks

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32657

        #4
        Yes. Basically, it's as simple as that.

        When you have a CMD file that can be executed then you may want to create a shortcut to it, but that's dead easy too. Just Copy the file in Windows Explorer and select Paste Shortcut from the Right-Click menu.

        Comment

        • matt753
          New Member
          • May 2010
          • 91

          #5
          Thanks that worked perfectly!

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32657

            #6
            Cool. I'm pleased that helped :)

            Comment

            Working...