Link to home
Start Free TrialLog in
Avatar of PJan8724
PJan8724

asked on

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.




ASKER CERTIFIED SOLUTION
Avatar of [ fanpages ]
[ fanpages ]

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of [ fanpages ]
[ fanpages ]

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.
Avatar of PJan8724

ASKER

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.