How to open cmd and pass parameter through batch file

batch-filecmd

I want to create a batch file to run the command. I want to add IP in my command.

My command is

 route add 26.284.254.269 mask 245.245.256.236 24.18.16.4

The above IPs are examples not actual.

I have created a batch file named runAs.bat. It successfully run in login Administrator.
I need to open command prompt as runas domain-name\administrator password and pass the above command in it in windows xp.
I have used the following command.

runas domain-name\administrator password cmd "route add 26.284.254.269 mask 245.245.256.236 24.18.16.4"

But it shows RUNAS USAGE:
How to use RUNAS.

Where is the problem in my command. I had google about it but noone could help me. Please give some suggestion or batchfile command for this.

Best Answer

The runas command usage shows that the user must be prefixed with a forward slash; possibly that is why you are getting the message. From the runas /? help:

RUNAS [ [/noprofile | /profile] [/env] [/netonly] ]
        /user:<UserName> program

You can execute a command with cmd by using

cmd /c [command]