Forum Home
Press F1
 
Thread ID: 74253 2006-11-16 06:48:00 Batch file wanted to switch default printer chainey (9225) Press F1
Post ID Timestamp Content User
499664 2006-11-16 06:48:00 Anybody know if there's a way to automatically switch the default printer based on whether the computer is connected to a LAN or not?

I have to remember to keep switching them back and forth from home to work. If a startup batch file or something equivalent could set it for me, that would be great.


Chainey.
chainey (9225)
499665 2006-11-16 07:46:00 What OS? Can certainly have a script to set the default printer but to only run when on the Lan or not I'm not sure about. You could have the script on the desktop to double click to run when required. berryb (99)
499666 2006-11-16 08:02:00 Sorry, should have said: Windows XP Professional.

If it's any help, I notice that I don't have to switch my method of accessing the internet. The computer "knows" whether it needs to dial up first or not. Maybe that setting, wherever it may be, could also be checked by the script?
chainey (9225)
499667 2006-11-16 08:40:00 get a registry snap shot program (www.snapfiles.com) take one before changing printer and on after. That will id the registry key, then all you have to is export the key twice
once for home setting (call the file created home.reg)
once for work setting (calll it work.reg)

then to swap between two setup the just double click on the setup you want home.reg for home printer ( i think you get the idea)

If you dont feel comfortable about going into the registry DONT !!!!!!!

Now if you want to get adventurous write a vbs script that asks you which setup you want and changes the reg key depending on the answer A bit of googling should reveal a script that comes close just modify it a bit
beama (111)
499668 2006-11-17 03:11:00 That's a cool tip thanks. It'll be useful in all sorts of circumstances.

However ... for the printer thing I'm really looking for something "set and forget". It's not that onerous to change the default printer, but I simply don't remember, then I send something to print and wonder where it's gone.

Something that runs on startup and can sense whether I'm on a LAN or not would be ideal.


Thanks

Chainey.
chainey (9225)
499669 2006-11-17 21:37:00 How about this: What if the batch file itself were on the LAN and another batch file (or script or whatever) were to check for the first batch file. If it's found it's run to change the printer to the LAN one, else the printer is changed to the local one.

Would that work?
chainey (9225)
499670 2006-11-18 01:35:00 I'm sure there is a built in way to set up things according to whether you are on a network or not (or even on a different network). This sort of thing is essential for laptops (used both at work and at home). Where are all the XPerts?

Changing the registry might work; I wouldn't like to do that as a routine thing. ;)

It was easy enough to resssign things in DOS. :D

This method (technet2.microsoft.com/WindowsServer/en/library/faf8d8aa-fe33-46ea-a95f-3340bb01f6191033.mspx?mfr=true) might work[/b]. It involves disabling the automatic connection to a LAN, and makes you choose which LAN you want. Then you have a different hardware profile for each LAN. That's probably the right way to do it: and it should be fairly well debugged because a lot of MS's business customers would want it. :thumbs:
Graham L (2)
499671 2006-11-23 21:18:00 This program may do the job

www.all4you.dk
snoopy (74)
499672 2006-11-23 22:51:00 Why not get your batch file to ping the print server? If it gets a ping reply, set the LAN printer as default - if not, set the local printer. Erayd (23)
499673 2006-11-25 09:15:00 This program may do the job

www.all4you.dk

Thanks very much. That's exactly what I wanted.

Really appreciate your taking the time to post a reply.


Cheers

Chainey.
chainey (9225)
1