Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Code to Map Network Drive

Options
  • 15-06-2005 9:01am
    #1
    Closed Accounts Posts: 5


    Hi All,
    I'm trying to create a program that will map a drive letter. I don't even know where to start... any ideas? :rolleyes:


Comments

  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    What language?

    Probably best to make a system call to NET USE


  • Registered Users Posts: 1,186 ✭✭✭davej


    A DOS command batch file will accomplish this for you quite easily (just fill in the details in the angle brackets):

    NET USE <DRIVELETTER>: \\<server>\<sharename> <Password> /USER:<DOMAIN>\<USERID>

    davej


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    Just a word of warning. If you use that net use command when you are finished run..

    NET USE <DRIVELETTER> /DELETE

    This will free up the resource. In some cases you can lock up drive letter from being used/accessed until a reboot if you don't do this.

    Also if you use * instead of drive letter it will find the first free one. Not sure how you would find what drive was assigned (you would have to read stdin).

    Also you can do...

    NET USE \\<server>\<sharename> <Password> /USER:<DOMAIN>\<USERID>

    This will give access to "\\<server>\<sharename>" (no need for drive letter) but could cause problems if you have very long directory paths.


  • Closed Accounts Posts: 5 athlone


    Thanks - this works well - it justs gives me one problem, the folder name has a space in the title eg "team folder". Is there any sqiggle or anything that will represent a space in dos?


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    Afaik, you can put the share path inside double quotes, and leave the space in it.


  • Advertisement
  • Closed Accounts Posts: 5 athlone


    Magic! Thanks for your help folks! Much appreciated!


  • Registered Users Posts: 4,003 ✭✭✭rsynnott


    Is Windows still limited to 26 drives? ;)


  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 91,690 Mod ✭✭✭✭Capt'n Midnight


    rsynnott wrote:
    Is Windows still limited to 26 drives? ;)
    Back in the days , was it dos 2.11 or 3 ? You just put ramdrive in the config.sys loads of times. After A-Z it when all the way through the Ascii table - got as far as _: once.


Advertisement