• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 362
  • Last Modified:

VB Script Command Shell

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
PJan8724
Asked:
PJan8724
  • 2
1 Solution
 
[ fanpages ]IT Services ConsultantCommented:
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
 
[ fanpages ]IT Services ConsultantCommented:
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
 
PJan8724Author Commented:
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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now