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.
Not having wrote Windows scritps in a while, I'd think something along the lines of Code: \\pcname /USER:<username> <password>
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!
Works perfectly, thanks Glider! Code: @echo off title Map Network Drives echo Mapping Network Drive... net use Z: \\Fileserver\c$ /user:username password