How do I execute cmd commands through a batch file?


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

  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

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

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

This question is tagged with batch-file cmd windows-scripting

~ Asked on 2013-05-24 05:01:55

The Best Answer is


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.

Try something like this for a start:

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

~ Answered on 2013-05-24 05:09:13


I think the correct syntax is:

cmd /k "cd c:\<folder name>"

~ Answered on 2013-05-24 05:12:53

Most Viewed Questions: