Running a BAT file from a webpage (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


and13345 -> Running a BAT file from a webpage (2/22/2005 11:48:55)

I need to kick off a batch file when a user clicks a button on my webpage. I have setup a page with a form that has a button that will POST to an ASP page. On that page I simply want to start the BAT file and then redirect back to the original page. My problem is how to start that bat file. The file exists locally on the users computer in a specific folder. If you go out and double click on the BAT file it runs and does everything I need it to do, I just can't figure out how to get my ASP page to run that BAT file. I have Googled for the answer and it looks like some SHELL command should work, but I get a type mismatch error when it runs the page.

Below is the code I have tried. I am just using the message box to make sure the page is starting correctly. I get the msgbox just fine and click OK and then get the error.
The response.write at the end is just for testing. After I get the error and say NO to debug it writes that line on the resulting page.

Any suggestions?

<SCRIPT LANGUAGE=VBScript>
'Script runs Batch file on local PC that executes VBScript to upload file.
	MsgBox "Click OK to execute the SHELL command.", 65, "Run BAT File."
	Shell "C:\soj\calendar\exportcalendar_upload.bat"
'End of script.
</SCRIPT>
<%
response.write "This is the exportcalendar_upload_bat.asp file"
%>




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
3.100586E-02