Page 1 of 1

Create a batch file for routing a printer

Posted: 01 Dec 2010 17:18
by gedinfo
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

Re: Create a batch file for routing a printer

Posted: 01 Dec 2010 19:45
by orange_batch
Doesn't look like anything wrong with the script.

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