Link to home
Start Free TrialLog in
Avatar of Big Monty
Big MontyFlag for United States of America

asked on

WScript problem running command prompt

Hi all,
I have the following code I'm trying to call from an asp script:

      dim shellCommand
      shellCommand = "cmd.exe /c dir > c:\temp\a.txt"
      
      dim i
      i = oScript.Run (shellCommand, 0, True)

The value for i is always 1, indicating an error, although no error messages appear, and c:\a.txt does not appear.. I've set up full permissions to the IUSR account on c:\temp and also gave full permissions to the IUSR account on cmd.exe. cmd.exe is in my system path, and if i omit the /c switch (which closes the cmd window once its done), I see the cmd.exe in the task manager so i know its running.

Any ideas?
B.D.
Avatar of Big Monty
Big Monty
Flag of United States of America image

ASKER

i can also just run:

cmd.exe /c dir

and i get the proper return code (which is 0) so it has something to do with writing a file to c:\temp
Avatar of golfDoctor
golfDoctor

"and c:\a.txt does not appear.. ":

Are yoiu checking the right folder?  Forgot \temp\.  Was that a typo?

And have you tried ---> , 1, true
ya that was a typo, sorry about that.

i did try changing it to a 1 but got the same result.
OK, what if you try a folder within the site root that has modify permissions for IUSR?
earlier on on the script i am writing to a temp file in the same directory so i know i can write to it.
"earlier on on the script i am writing to a temp file in the same directory so i know i can write to it."

Yes, but not using command prompt, right?  command calls with vbscript and FSO are not the same.
ASKER CERTIFIED SOLUTION
Avatar of golfDoctor
golfDoctor

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
i see what you're saying. i'll give it a shot and let you know.
thanks for that, it worked!

i just assumed that since i had FSO permissions, I would be able to have execute (modify) permissions, since I had full control checked off in the security properties. anyways, i'll just a use a folder within my website to do whats needed.

Thx again!
B.D.
great