Batchfile Question

Associate
Joined
22 Dec 2002
Posts
1,190
Location
Teesside, UK
currently have a batch file to delete a printer on login. This refers to the 'Microsoft Document Image Writer'. The only problem I have is if the printer has already been moved the batch file complains with an error that the printer cannot be found.

Is there a command or something can add so that it can check and ignore if the printer has already been removed, or at least not show any errors to the user.

Here is the batch file contents;
rundll32 printui.dll,PrintUIEntry /dl /n "Microsoft Document Image Writer"

Thanks,
andy
 
Thanks for replying.

If the printer is re-installed at any point. Say through an Office update or windows update would it not still skip the removal of the printer.

Having said that now that you have hit on the IF command, I'm wondering if there is a way for the PC to check if the Printer is installed. Kind of if it is run this command. If not don't
 
Sorry my batch file experience is fairly limited. Is that just a case of putting null at the end. I'm not at work at the moment to further test.
 
Thanks for your replies.

Tried 2> nul and > nul 2>&1, but the error of not finding the printer still pops up. Any further suggestions much appreciated.

Edit. I may have solved this myself by including the /q command.
 
Last edited:
sorry to keep questioning this. All is working great, but there is one slight problem. The users dont have permissions to remove the printer, so the logon script appears to miss this part.

Is it possible to include a line in the script to use the Run As feature.
 
Back
Top Bottom