Is it possible to run an asp script on the command line? What is the command?
-
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"AardVark71– AardVark712012-09-17 08:41:15 +00:00Commented 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...Baz– Baz2012-09-17 08:47:34 +00:00Commented Sep 17, 2012 at 8:47
-
If your default browser is IE you can kill it with: taskkill /F /IM iexplore.exeAardVark71– AardVark712012-09-17 09:24:15 +00:00Commented Sep 17, 2012 at 9:24
Add a comment
|
2 Answers
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
Comments
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
AardVark71
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/…
Rafael
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)
cc4re
sorry all , i though it was asp.Net