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

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

问题描述

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

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

  1. 打开cmd
  2. 运行cmd命令cd c:Program filesIIS Express
  3. 运行cmd命令iisexpress/path:"C:FormsAdmin.Site"/port:8088/clr:v2.0
  4. 使用 URL= http://localhost:8088/default.aspx 打开 Internet Explorer 8

注意:cmd 窗口在执行命令后不应关闭.

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

我尝试了 start cmd.exe/k "cd & cd ProgramFilesIIS Express",但它不能解决我的目的.

I tried start cmd.exe /k "cd & cd ProgramFilesIIS 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 filesIIS Express
start iisexpress /path:"C:FormsAdmin.Site" /port:8088 /clr:v2.0
start http://localhost:8088/default.aspx
pause

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

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