Solved

How to use the WScript.Shell?

Posted on 2001-07-26
2
3,178 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
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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 information …
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now