|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Executing a .bat file using .asp
I'm trying to execute a .bat file using .asp on Win2000 system. but it doesn't seem working..
here is the code i'm trying <% set oWS=server.createobject("WScript.shell") ret=oWS.Run("c:\some.bat", 2, true) if(ret=0) then response.write("it is working<br>") else response.write("not working<br>") end if %> I'm getting message " message not working " . Should i change some permission for accessing Windows Scripting Host. |
|
#2
|
|||
|
|||
|
The code itself appears fine. Have you tried outputting the return code, I/you could then look this up in the MSDN and maybe see whats actuall happening. Otherwise try using the .exec method instead, you might have some more sucess. Also, does the batch file actually run? you may find that a non xero code just means that the program is still executing?
|
|
#3
|
||||
|
||||
|
Andrew,
Thanks for the reply .actually i tried out all the methods which given out there in MSN. <<Also, does the batch file actually run? >> .bat is executing fine on local system. My question is that ,,, Should i change some permission in Admin Panel for running this .bat from .asp using WScript.exe? I gone through all documentation on MSN,but no luck so far..even simple dos commands are not Running using that script.. Thanks again Andrew
__________________
SR - webshiju.com www.lizratechnologies.com "The fear of the LORD is the beginning of knowledge..." |
|
#4
|
|||
|
|||
|
OK, i'm not 100% sure that this will solve your problem but its worth a go...
* Run the Internet Services Manager for IIS. * Right Click on the Website in question and select properties * Under the 'Directory' Tab, Towards the bottom, change Execute Permissions from Scripts Only to Scripts and Executables. This might help. Let me know, - Andrew |
|
#5
|
||||
|
||||
|
Andrew,
<< Under the 'Directory' Tab, Towards the bottom, change Execute Permissions from Scripts Only to Scripts and Executables. >> I had tried that earlier ,changing the permissions in IIS admin but that didn't work.... Any way now it's started working !! I just installed asp.net on the server ,after that suddenly WScript started executing properly.. i think something must have gone wrong in the earlier version of WScript component. Thanks Andrew for your help. I really appreciate that.. |
|
#6
|
|||
|
|||
|
Executing a .bat file using .asp
Dear Shiju and andrew...
I'm using Server.CreateObject("WScript.Shell") to execute the batch file in command line. Previously i was using Windows 2000 Server. It was working fine. Now I changed my computer and it has Windows 2000 Professional (workstation). Now the same code Server.CreateObject("WScript.Shell") is not working. It throws an error "Object can not be created". Is Server.CreateObject("WScript.Shell") works only on 2000 Server.? Please help me. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > Windows Help > Executing a .bat file using .asp |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|