|
-
Jul 1st, 2002, 05:41 AM
#1
Thread Starter
Fanatic Member
Bat file
Whenever I release a new version of my software, I place the new version on the company server.
When users run their current version, it determines the version is not the latest and copies the latest version from the server via a bat file.
The bat files just copies across the new version and runs it. However the bat file does not close until after my software is closed (or the bat file is closed by the user).
How can I make the bat file close, and run my prog??
VB6 sp5, SQL Server 2000, C#
There are no stupid questions. Only stupid people. 
-
Jul 1st, 2002, 08:28 AM
#2
Frenzied Member
Here's an idea - why not write a quick VB app to copy files instead of the .BAT file. Then this app could SHELL the main program just before it closes.
I have written similar programs - you create a 'BOOTSTRAP' program that sits on the network - this is the program that the user runs. My program checks the file date/time of the server copy of the .EXE and the one on the user's PC - if it is different the new .EXE is copied down to the user's machine (Along with any other files required), and then the .EXE is run from the user's C: drive.
'Buzby'
Visual Basic Developer
"I'm moving to Theory. Everything works there."
-
Jul 1st, 2002, 08:34 AM
#3
Thread Starter
Fanatic Member
Cheers
I'll give that a go later on today.
VB6 sp5, SQL Server 2000, C#
There are no stupid questions. Only stupid people. 
-
Jul 1st, 2002, 08:44 AM
#4
Frenzied Member
Another option is to put "exit" at the very end of your batch file,
which will close it.
-
Jul 1st, 2002, 08:46 AM
#5
Thread Starter
Fanatic Member
Putting exit at the end of the batch file does not work.
It does work when I'm not calling another app, but when I do it doesn't work.
VB6 sp5, SQL Server 2000, C#
There are no stupid questions. Only stupid people. 
-
Jul 1st, 2002, 08:48 AM
#6
Frenzied Member
Your calling another app in the batch file, right? If so, the batch
file will wait for the program you just ran to end before it runs the
next line.
-
Jul 1st, 2002, 08:51 AM
#7
Thread Starter
Fanatic Member
Thats the point I'm getting at.
You need to go back and read my original post.
VB6 sp5, SQL Server 2000, C#
There are no stupid questions. Only stupid people. 
-
Jul 1st, 2002, 08:56 AM
#8
Frenzied Member
True. WHat you could do is this to run the batch.
VB Code:
Sub RunBatch(BatchFile As String)
Dim x() As String, y As String
Open BatchFile For Input As #1
y = Input(LOF(1), 1)
Close #1
x = Split(y, vbNewLine)
For i = 0 To Ubound(x)
Shell x(i)
Next i
End Sub
Try that.
-
Jul 1st, 2002, 08:57 AM
#9
Instead of using a compiled VB app to copy the file as suggested above, you could instead of the BAT file use a simple VBScript file. That is also easy to customize if the path of the source would ever change.
-
Jul 1st, 2002, 09:07 AM
#10
How do you start the batch file?
If you start it like this:
Shell "command.com /c " & chr(34) & "c:\yourdir\thebat.bat" & chr(34)
the dos window will close when the last line is executed, and not when your program closes.
Last edited by Frans C; Jul 1st, 2002 at 09:10 AM.
-
Jul 1st, 2002, 09:10 AM
#11
Thread Starter
Fanatic Member
Thanks Frans C.
I'll give that a go later on.
VB6 sp5, SQL Server 2000, C#
There are no stupid questions. Only stupid people. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|