473,378 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 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 2615

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 collector works and that I mislead people. Since...
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 intranet. Last week it stopped working... and...
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 put my html file in the web server...
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 reference to the Com Types in your application. ...
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 data themselves. but the question is how to drive...
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 FTP command. Our code is thus: sExe =...
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 alternatives to getting the computer name and the UserDomain....
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 is Microsoft VBScript runtime error '800a004c'...
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> <Body> <script language="VBScript"...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.