Development Batch File Logon/Connect To script

Discussion in 'Software' started by Lazlow, 16 Jan 2007.

  1. Lazlow

    Lazlow I have a dremel.

    Joined:
    8 Aug 2003
    Posts:
    1,464
    Likes Received:
    0
    I'm trying to create a batch file, that when executed, will connect a PC to another.

    Normally, I'd have to open Run from the Start Menu, then type in the name of the PC (\\pcname) and it'll prompt me for a username and password as the current username/password isn't present on the PC I'm trying to connect to.

    Following my logic? Good. I want something similar to the following, but in correct syntax:
    Code:
    @echo off
    echo Connecting to PC(s)...
    \\pcname
    username=*usernamegoeshere*
    password=*passwordgoeshere*
    echo Connected!
    
    Any ideas?

    EDIT: Don't suggest I setup user accounts on the PC(s) as I'm aware of that, this is for temporary connections, that usually are only needed to print/access files.
     
  2. Glider

    Glider /dev/null

    Joined:
    2 Aug 2005
    Posts:
    4,173
    Likes Received:
    21
    Not having wrote Windows scritps in a while, I'd think something along the lines of
    Code:
    \\pcname /USER:<username> <password>
     
  3. Lazlow

    Lazlow I have a dremel.

    Joined:
    8 Aug 2003
    Posts:
    1,464
    Likes Received:
    0
    OK, the command prompt and .bat files wont accept the \\pcname method, but it looks like integrating it into a batch file for mapping network drives works - I'll logon as another user without access and try it - thanks!
     
  4. Lazlow

    Lazlow I have a dremel.

    Joined:
    8 Aug 2003
    Posts:
    1,464
    Likes Received:
    0
    Works perfectly, thanks Glider!
    Code:
    @echo off
    title Map Network Drives
    echo Mapping Network Drive...
    net use Z: \\Fileserver\c$ /user:username password
    
     

Share This Page