如何通过批处理文件执行cmd命令? [英] How do I execute cmd commands through a batch file?

查看:2412
本文介绍了如何通过批处理文件执行cmd命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想写一个批处理文件,它将按照给定顺序执行以下操作:

I want to write a batch file that will do following things in given order:


  1. 打开cmd

  2. 运行cmd命令 cd c:\Program files\IIS Express

  3. 运行cmd命令 iisexpress /path:\"C:\FormsAdmin.Site/ port:8088 /clr:v2.0

  4. 打开 Internet 资源管理器  8 与URL = http:// localhost:8088 / default.aspx

  1. Open cmd
  2. Run cmd command cd c:\Program files\IIS Express
  3. Run cmd command iisexpress /path:"C:\FormsAdmin.Site" /port:8088 /clr:v2.0
  4. Open Internet Explorer 8 with URL= http://localhost:8088/default.aspx

注意:执行命令后,不应关闭cmd窗口。

Note: The cmd window should not be closed after executing the commands.

我尝试了启动cmd.exe / kcd \& cd ProgramFiles \IIS Express,但这不能解决我的目的。

I tried start cmd.exe /k "cd\ & cd ProgramFiles\IIS Express", but it is not solving my purpose.

推荐答案

所以,做一个实际的批处理文件:打开记事本,输入你想要运行的命令,并保存为。 bat 文件。然后双击.bat文件运行它。

So, make an actual batch file: open up notepad, type the commands you want to run, and save as a .bat file. Then double click the .bat file to run it.

尝试这样的开始:

c:\
cd c:\Program files\IIS Express
start iisexpress /path:"C:\FormsAdmin.Site" /port:8088 /clr:v2.0
start http://localhost:8088/default.aspx
pause

这篇关于如何通过批处理文件执行cmd命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆