Solved

VB Script Command Shell

Posted on 2006-06-28
4
353 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
  • 2
4 Comments
 
LVL 35

Accepted Solution

by:
[ fanpages ] earned 500 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now