2

Is it possible to run an asp script on the command line? What is the command?

3
  • On a webserver that's already running? Then use the start command to fire up the default browser. For instance: start "yourdomain.com/yourpage.asp" Commented Sep 17, 2012 at 8:41
  • @AardVark71 But I would need the browser to close again after the script has run, otherwise there will be a bunch of open browsers... Commented Sep 17, 2012 at 8:47
  • If your default browser is IE you can kill it with: taskkill /F /IM iexplore.exe Commented Sep 17, 2012 at 9:24

2 Answers 2

3

If the Classic ASP file is already running on a webserver somewhere, and you simply want to call it to execute it, then you could create a .VBS file with the following code:

url="http://foo.com/bar"
Set WshShell = WScript.CreateObject("WScript.Shell")
Set http = CreateObject("Microsoft.XmlHttp")
http.open "GET", URL, FALSE
http.send ""

If you want to execute it with the Windows task scheduler, create a single line .CMD file that calls the .VBS file, e.g.:

cd \directory-containing-foobar-script
cscript foobar.vbs

Hope this helps

Sign up to request clarification or add additional context in comments.

Comments

0

Generally .asp files cant be run from command line like php -r <php code> in PHP but what you can do is to start the IIS server from command line with parameters and then execute the code like this:

start /B "C:\Program Files\Common Files\Microsoft Shared\DevServer\9.0\WebDev.WebServer.EXE" /port:9090 /path:"D:\project\MYPROJECT" /vpath:"/MYPROJECT"

// and then start the url
start "http://localhost:9090/MYPROJECT/"

3 Comments

This is cool.... but I believe this is the ASP.NET Development Server (Casini) which does not support classic asp. IIS Express probably can be started in a similar fashion and does support classic asp pages. See here for the startup options: iis.net/learn/extensions/using-iis-express/…
the question is about Classic-asp not ASP.net, due to this fect the answer is invalid (because this server doesn't run Classic-ASP code)
sorry all , i though it was asp.Net

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.