views:

438

answers:

7

I am trying to create a .bat file that starts the ASP.NET Dev Server outside of Visual Studio, and then opens the site in a browser. What I have so far does successfully start the Dev Server, but then it stops there and doesn't open the browser.

Here is what I have in my .bat file:

"C:\Program Files\Common Files\Microsoft Shared\DevServer\9.0\WebDev.WebServer.EXE" /port:4608 /path:"C:\Projects\a_project\Dev\path-to-site" /vpath:"/path-to-site"
start "http://localhost:4608/path-to-site/sitefinity"

Any ideas what is wrong with this? Thanks

UPDATE:

Based upon some of your answers I added the start /B to the first line and now neither the the web server or the browser open. I just get a new empty cmd prompt window. Here is the latest that is not working:

start /B "C:\Program Files\Common Files\Microsoft Shared\DevServer\9.0\WebDev.WebServer.EXE" /port:4608 /path:"C:\Projects\a_project\Dev\path-to-site" /vpath:"/path-to-site"
start "http://localhost:4608/path-to-site/sitefinity"

UPDATE 2:

I figured it out with help from you all and some trial and error. See the final solution below.

A: 

I think you just need a 'start' at the beginning of the first line.

nickd
A: 

Why do you want this?

You could easily write a script that will make your website run on IIS.

Henrik Jepsen
This bat file will go on the desktop of a non-programmer that has Visual Web Developer on their machine but would prefer not to have to use it just to run the site locally..... I know, it seems weird but that's the solution we came up with.
NathanD
+1  A: 

Your web server will only be ON until the batch program is running. It will stop after the batch file finishes.

You should use the START command with the /b switch to keep it running as a background process. Try this:

start /B webdev.webserver.exe .........

Raj More
I tried this and it doesn't work, please see my updated question above.Thanks
NathanD
A: 

Try this:

start "" /b WebDev.WebServer.EXE

It seems that the first parameter title becomes not-optional when a switch parameter is used.

Mehmet Ergut
+3  A: 

The following was the final working script:

start /D "C:\Program Files\Common Files\Microsoft Shared\DevServer\9.0" /B WebDev.WebServer.EXE /port:4608 /path:"C:\Projects\a_project\Dev\path-to-site" /vpath:"/path-to-site"
start http://localhost:4608/path-to-site/sitefinity/

You'll notice I had to use the /D param to get into the right path (I wanted the user to be able to just run this off of their desktop) and then use /B param to run the given command in the background.

Also, I found that in order to use the start command and just pass it a URL directly to just use the default browser you have to state the URL with no quotes.

You can use the ASP.NET Dev Server for VS 2010 using the following:

start /D "C:\Program Files\Common Files\Microsoft Shared\DevServer\10.0" /B WebDev.WebServer40.EXE /port:4608 /path:"C:\Projects\a_project\Dev\path-to-site" /vpath:"/path-to-site"
start http://localhost:4608/path-to-site/sitefinity/

Thanks for everyones help.

NathanD
A: 

How can I use %ProgramFiles% variable enviroment??

I get error in my bat if use this:

SET WEBDEV="\Archivos comunes\Microsoft Shared\devServer\9.0\"

START /D %ProgramFiles%%WEBDEV% /B WebDev.WebServer.EXE /port:1633 /path:"C:\Trabajo\Arquitectura\Main\SEG\Frk.Security.Host"

Thanks in advanced

Alhambra Eidos
A: 

Try replacing

c:\Program Files\Common Files\

with

%CommonProgramFiles%\
Thomas Schreiner