Hi all,
I have spent the last three days on this problem. Looked in many forums and not found the answer as yet. Hopefully ye can help.
I have two functions. One works fine, the second does not.
First Function
Function try1
SET objShell = CreateObject("Wscript.Shell")
DIM objExec, strResult
cmd = "%comspec% /c nslookup -type=MX www.yahoo.com"
SET objExec = objShell.Exec(cmd)
WHILE objExec.Status <> WshFinished
'Wait for the command to be run completely
WEND
strResult = objExec.StdOut.ReadAll
Set objExec = Nothing
Set objShell = Nothing
response.write(strResult)
End Function
OUTPUT : as expected .i.e.
Server: server213-171-192-249...... and so on..
Second Function
Same as first except for the command line
Function try2
SET objShell = CreateObject("Wscript.Shell")
DIM objExec, strResult, Cmd
Cmd = "%comspec% /c dir D:\directory\*.* > D:\directory\zzz.txt"
SET objExec = objShell.Exec(Cmd)
WHILE objExec.Status <> WshFinished
'Wait for the command to be run completely
WEND
strResult = objExec.StdOut.ReadAll
Set objExec = Nothing
Set objShell = Nothing
response.write(strResult)
End Function
No Output. And no zzz.txt file is created.
When I run the above 'Cmd' string from the command line it works fine.
I have given I_USR<machine_name> Full permissions (read/write/execute) on the directory, all of it's files and on the CMD.EXE
If anyone can help I would be very grateful
Thanks
Edurran.