Windows Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsWindows Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 29th, 2002, 10:51 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 9
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan
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.

Reply With Quote
  #2  
Old January 29th, 2002, 06:03 PM
andrewl41 andrewl41 is offline
Coder Extraordinaire
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Location: London
Posts: 35 andrewl41 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 47 sec
Reputation Power: 7
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?

Reply With Quote
  #3  
Old January 31st, 2002, 12:28 PM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 9
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan
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..."

Reply With Quote
  #4  
Old February 2nd, 2002, 09:28 AM
andrewl41 andrewl41 is offline
Coder Extraordinaire
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Location: London
Posts: 35 andrewl41 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 47 sec
Reputation Power: 7
Lightbulb

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

Reply With Quote
  #5  
Old February 4th, 2002, 04:12 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 9
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan
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..

Reply With Quote
  #6  
Old October 27th, 2003, 02:38 AM
pcshan pcshan is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: India
Posts: 1 pcshan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to pcshan
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsWindows Help > Executing a .bat file using .asp


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway