Big Monty
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.
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.
"and c:\a.txt does not appear.. ":
Are yoiu checking the right folder? Forgot \temp\. Was that a typo?
Are yoiu checking the right folder? Forgot \temp\. Was that a typo?
And have you tried ---> , 1, true
ASKER
ya that was a typo, sorry about that.
i did try changing it to a 1 but got the same result.
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?
ASKER
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.
Yes, but not using command prompt, right? command calls with vbscript and FSO are not the same.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i see what you're saying. i'll give it a shot and let you know.
ASKER
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.
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
ASKER
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