472,352 Members | 1,540 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,352 software developers and data experts.

Problem with CreateObject("Wscript.Shell")

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.
Jul 26 '07 #1
0 2444

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Andreas Suurkuusk | last post by:
Hi, I just noticed your post in the "C# memory problem: no end for our problem?" thread. In the post you implied that I do not how the garbage...
5
by: Bill | last post by:
I used to be able to run the following ASP code on our corp machine (W2K Server Edition and IIS-5) and successfully send a net-msg to anyone on our...
2
by: Mike John | last post by:
I am trying to use the shell object to send keys to the explorer browser to run the send page funcion. I am receiving the above error only when I...
1
by: Dennis | last post by:
I use the below code to get the Network Places items. However, this requires "Late Binding". I read that you can avoid late binding by adding a...
1
by: key9 | last post by:
Hi all I have some data to process, whith complex mechanism,I put these process mechanism as plugins. and design lots of classes to abstract...
3
by: ManningFan | last post by:
Due to the way our IT group has set up our servers, we are not allowed to use the Shell() command. We are already doing a similar action with an...
3
by: radrain | last post by:
Unable to CreateObject("wscript.network") in IE7. This works fine in IE6 BUT this is now considered to be 'unsafe' and I cannot find any...
3
by: =?Utf-8?B?VG9kZA==?= | last post by:
trying to access files located on another server within the network. the folder is shared out and we created a virtual directory as well. The error...
2
by: moodyman13 | last post by:
Hi all, Hoping someone can help me. I'm using WSH to automatically map a network drive when someone opens a webpage. Below are the codes <HTML>...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.