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
Solved

How to use the WScript.Shell?

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

839 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