Link to home
Start Free TrialLog in
Avatar of telliot79
telliot79

asked on

open app / run bat file from asp

okay,

have searched a few thousand threads trying to figure out the permissions denied error I am getting. obviously I am doing something wrong here. Anyway, my pc is set up as a web server, and I am just trying to open a file from an asp page. I am using xp OS. My latest attempt has been:

    Dim wshell, intReturn
    set wshell = server.createobject("wscript.shell")
    intReturn = wshell.run("%comspec% /c dir *.* > c:\test.txt", 0, True)
    Response.Write( intReturn )
    set wshell = nothing
 
C:\test has given the Internet Guest Account full permissions (well everything apart from the full control option, and when I check this off, it makes no difference)

Am I missing something else here.

Thanks in advance for any assistance.
Avatar of alorentz
alorentz
Flag of United States of America image

Yeah, your error is probably on this line:

set wshell = server.createobject("wscript.shell")

Not on this line:
intReturn = wshell.run("%comspec% /c dir *.* > c:\test.txt", 0, True)

What does your error message line tell you?
Also, 3 out of 4 of your questions are still open...please close the old ones.
i've run into this issue as well.  I ended up finding out that I had to give IUSR access to cmd, which of course is highly unadvisable
Avatar of telliot79
telliot79

ASKER

my error messege:

Error Type:
Microsoft VBScript runtime (0x800A0046)
Permission denied
/batTest2.asp, line 4

but I have given full permissions everywhere I can think of.


"I ended up finding out that I had to give IUSR access to cmd, which of course is highly unadvisable"
I don't even know what this means to be honest.

My ultimate goal is to run a batch file of a .exe file to restart services from a web page.

3 out of four of my questions are open because they were unanswered. how do I close them with out allocating the points?
>>3 out of four of my questions are open because they were unanswered. how do I close them with out allocating the points?

Post to Communit Support to have them closed:
https://www.experts-exchange.com/Community_Support/
cmd is the Command Prompt, if you go to start->run and type in cmd and hit enter, you'll see what I mean.

what services are you looking to restart? (there may be a better method than prompting out to shell)
i know what the cmd prompt is and how to get it going, I just don't understand how to give IUSR access to cmd.

The service I want to restart is calld "ZOOM Image Server" I am not sure exactly the best way about going about this, but my ultimite goal is to get this restarted from a web page so if I am out of office I can, in theory, hit the web page from my cell phone and restart the services. This is my ultimate goal, so maybe I should make that another post, in the mean time I just want to get over this first problem. I will uip the points if I get a resolution for this whole task however.

Thanks both for your assistance.
ASKER CERTIFIED SOLUTION
Avatar of alorentz
alorentz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
well...you'd have to give access to  the /system32 folder on the page's server which I would highly recommed against.

q4u?  do you have the latest version of wscript installed on the server?
http://www.microsoft.com/downloads/details.aspx?FamilyId=C717D943-7E4B-4622-86EB-95A22B832CAA&displaylang=en

i also wonder if you would have to change this line:
set wshell = server.createobject("wscript.shell")

to:
Set wshell = WScript.CreateObject("WScript.Shell")
brilliant mate.

thanks.

still haven't quite got it working, i am going to put another post up to convert that vbs to asp as I can't seem to get it going.