如何打开cmd并通过批处理文件传递参数
我想创建一个批处理文件来运行该命令。我想在我的命令中添加IP。
我的命令是
route add 26.284.254.269 mask 245.245.256.236 24.18.16.4
上述 IP 仅为示例,并非实际 IP。
我创建了一个名为 runAs.bat 的批处理文件。登录管理员成功运行。 我需要以 runas 域名\管理员密码打开命令提示符,并在 Windows XP 中传递上述命令。
我使用了以下命令。
runas domain-name\administrator password cmd "route add 26.284.254.269 mask 245.245.256.236 24.18.16.4"
但它显示了 RUNAS 的用法: 如何使用 RUNAS。
我的命令哪里有问题。我用谷歌搜索了一下,但没有人能帮助我。请为此提供一些建议或批处理文件命令。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
runas命令用法表明用户必须以正斜杠为前缀;可能这就是您收到该消息的原因。来自 runas /?帮助:
您可以使用 cmd 执行命令
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:
You can execute a command with cmd by using
尝试:
runas 命令没有密码参数 - 将管理员密码添加到批处理文件中确实不安全。
但您可以使用 /savecred 参数。
Try:
runas command does not have password parameter - it will be really insecure to add admin password to batch file.
But you can use /savecred parameter.