Solved

How to use the WScript.Shell?

Posted on 2001-07-26
2
3,202 Views
Last Modified: 2007-12-19
<%
  set oShell = Server.CreateObject ("WScript.Shell")
  cmd = "%COMSPEC% /c xcopy c:\test.txt d:\dellsftw\kevin"
  oShell.run cmd, 0, true
  oShell.close
%>

Above is the script I used to copy a file called test.txt from C:\ to D:\Dellsftw\Kevin.

During the first time I run this script I found it ok but I tried it for the second and third time, my Internet explorer keep on saying opening page, it seems like never ending. Why like this?

Where can I find the documentation for WScript object's information like what is the methods and properties inside, so that I know how to use it in the future.

Thanks for your help.
0
Comment
Question by:calven
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
DirkVe earned 40 total points
ID: 6321239
There's a small mistake in the copy statement, and therefore it doesn't work (even not the first time, but after th first time it keeps running and that's why the second time there's no response).

If it's correct that kevin is a directory, change this line

cmd = "%COMSPEC% /c xcopy c:\test.txt d:\dellsftw\kevin"
 
TO

cmd = "%COMSPEC% /c xcopy c:\test.txt d:\dellsftw\kevin\"

(extra \  after kevin).


Also, replace the close statement (this method doesn't exist):
replace oShell.close
with set oShell = Nothing

NOTE: Before you start testing this, close the browser and test in a new one, since you still have a process running.

Good luck.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6905130
This question has been finalized by an experts-exchange Moderator.  If you have any questions in this regard, please let me know and I'll return when I can.  The closing recommendations were posted in Community Support here:
http://www.experts-exchange.com/questions/Q.20282861.html

In the event Asker returns with additional needs regarding this question, please respond.

Thanks,
Moondancer - EE Moderator
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question