?
Solved

VB Script Command Shell

Posted on 2006-06-28
4
Medium Priority
?
360 Views
Last Modified: 2010-04-07
Hey Guys,

Just a quick question for all.  I'm writing a script with a function (listed below) using VBS that will copy a 1.7GB file from one server to another server on our network for processing.  We have a batch file in place at the current moment that I'm going to replace with the new script.  While the batch file works, the problem is that I have operators that need to run secondary processes once the copy is complete and with the batch file, they have no way of knowing how long the file takes to transfer other then waiting an appropiate length of time.  

What I'm trying to figure out a simple way of writing to a command window (shell out I suppose) letting the operators know the status of the cop, if the copy is still running or for that matter if it is completed.  Is there a way that I can write to a command window from inside my function (listed below) that will allow me to create some kind of generic message stating that the process is still running or that it is complete?

Sub CopyFile()
      dim fso
      dim FileToBeCopied
      set fso = CreateObject("Scripting.FileSystemObject")
      FileToBeCopied = "C:\Temp\temp\test123.txt"
      CopyLocation = "C:\Temp\test123.txt"
      
      'Time to check for the file
      if fso.FileExists(FileToBeCopied) = True then
            set temp = fso.getfile (FileToBeCopied)
            fso.copyfile FileToBeCopied, CopyLocation
                  If fso.FileExists(Copylocation)
                        response.write "File has been copied.  <-- will not write to a command window.
                                Set temp = fso.getfile (FileToBeCopied)
                        temp.delete
                        response.write "Original File Deleted"                                                      
      End If
End Sub

Thanks,

Pete J.




0
Comment
Question by:PJan8724
[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
4 Comments
 
LVL 35

Accepted Solution

by:
[ fanpages ] earned 2000 total points
ID: 17005692
Hi Pete,

I would suggest writing to either the NT System/Application Log (so that your operators can read this remotely from their own machines), or to a bespoke log file you create in a pre-defined (network) location in your code that can be concurrently read by your operators (using a suitable text editor, e.g. TextPad) whilst it is open for write access by your code.

There are also (share/freeware, and commercial) utilities available that can send SMS messages to a pager or a mobile telephone number when a task completes.  You may like to consider the copy process informing your operators by way of their mobile telephone handset that it is complete in this manner.

BFN,

fp.
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 17294937
Hi again Dan,

In the absence of any reply based on the only comment made by an expert (myself), I cannot say where the methods I suggested would be suitable for the individual case, but they are all viable options for others to consider.

At the very least I would like to see this question PAQ'ed (with no points refund), but if my comment is considered to be acceptable, then obviously please take this as the solution.

Thanks.

BFN,

fp.
0
 
LVL 1

Author Comment

by:PJan8724
ID: 17296391
Hey funpages and Dan,

Sorry about that, I completely forgot that I had this question open, my bad.  However the solution that was provided by funpages is not exactly what I was looking although it is a good idea.  Since our operators remote into the servers to run batch scripts, there is no reason to write to the NT System/Application log or even to write to a log file.  Looking into a log file or the application log for information would just be one more extra step the operators would have to take in an already overloaded schedule, hence the reason I wanted to write to a DOS window.  This way they would see it instantly, without having to look else where for the information.

However since funpages did provide an alternative solution that could work, I'm going to award him the points for effort.

Pete J.

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

762 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