1.

Solve : Developing BAT file?

Answer»

Hello. I am trying to develop a BAT file to speed things up every morning when I log in to my client's network. This is what I have to do every day when I start up my laptop:

(1) Open Outlook, then enter username and password.
(2) Connect printer by doing: Run \\Path1\ then select printer, then connect, then enter same usename and password
(3) open shared drive by doing: Run \\Path2\ and enter same usename and password

I know that the batch file is going to have these commands:
start \\Path1
start \\Path2

But I have no idea how to (1) select the printer and connect it, (2) include the username and password on all 3 above

Any help will be appreciated! Thanks!1. Either write your own script using VBScript or any other scripting language or use a free product like AutoIt. Batch files have a TOUGH time inputting data and keystrokes into a Windows program (Outlook).

2. This can be scripted but need to know whether this is a DOS or Windows type printer CONNECTION. If it's a DOS connection, you can use the NET USE command.

net use printername \\servername\devicename

If it's a Windows connection, you would need a script defining a network object and using the AddWindowsPrinterConnection method.

3. Not sure what you mean by open a shared drive. Usually you just connect and map the drive into your system.

net use driveletter: \\computername\sharename password

Note: password is optional.

Hope this helps. 8-)Sidewinder, thanks so much for your help. Unfortunately, I need to ask you for more detail, as I am not too familiar with these concepts...

I will look into AutoIt and see if I can learn how write script for the Oulook "problem" (guessing this ACCOMPLISHES the same function as a BAT file).

The printer connection is a Windows connection. I am using XP Media CENTER (not sure if this is important). Can you explain the AddWindowsPrinterConnection method? Can it be integrated with the batch file or with the script, or is this a completely different process?

I will try mapping the drive and see if it stays connected so that I don't have to enter username and password every day.

Thanks!the mapped drive will stay there however to prevent having to enter the password everyday you need to create a batch file like sidewinder suggested and then save it to the startup folder... this means whenever you log in the batch file will FUN and you wont have to enter a username or password to open the network drive.



Discussion

No Comment Found