Create a batch file for routing a printer

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
gedinfo
Posts: 1
Joined: 01 Dec 2010 17:13

Create a batch file for routing a printer

#1 Post by gedinfo » 01 Dec 2010 17:18

Hello, I would like to be able to put this command to a batch file:
Route add 192.168.3.0 mask 255.255.255.0 192.168.5.12 metric 30 -p

Here is what I have so far, and get an error on add.
Anyone have any suggestions?

Thank you

@ECHO OFF
if "%1"=="3" goto Route2
if "%1"=="4" goto Route2
:ERR
ECHO Type in Printer value first, followed by the last two numbers of the IP address.
ECHO routeprinter 4 5.12
goto END
:Route2
if "%2"=="" goto ERR
Route add 192.168.%1.0 mask 255.255.255.0 192.168.%2 metric 30 -p
goto END
:END
@ECHO ON

orange_batch
Expert
Posts: 442
Joined: 01 Aug 2010 17:13
Location: Canadian Pacific
Contact:

Re: Create a batch file for routing a printer

#2 Post by orange_batch » 01 Dec 2010 19:45

Doesn't look like anything wrong with the script.

Btw, the goto END on the bottom isn't necessary.

Post Reply