Solved

How to use the WScript.Shell?

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jquery to restrict certain words from input in form 11 47
Help with query 3 37
Html Table Looping (part 2) 5 35
add 'N to prepared ASP/VB insert statement 1 14
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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…

726 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