Results 1 to 11 of 11

Thread: Bat file

  1. #1

    Thread Starter
    Fanatic Member Stevie's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    565

    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.

  2. #2
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    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."

  3. #3

    Thread Starter
    Fanatic Member Stevie's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    565
    Cheers

    I'll give that a go later on today.
    VB6 sp5, SQL Server 2000, C#

    There are no stupid questions. Only stupid people.

  4. #4
    Frenzied Member macai's Avatar
    Join Date
    Jul 2001
    Location
    Napanoch NY
    Posts
    1,228
    Another option is to put "exit" at the very end of your batch file,
    which will close it.
    Luke

  5. #5

    Thread Starter
    Fanatic Member Stevie's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    565
    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.

  6. #6
    Frenzied Member macai's Avatar
    Join Date
    Jul 2001
    Location
    Napanoch NY
    Posts
    1,228
    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.
    Luke

  7. #7

    Thread Starter
    Fanatic Member Stevie's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    565
    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.

  8. #8
    Frenzied Member macai's Avatar
    Join Date
    Jul 2001
    Location
    Napanoch NY
    Posts
    1,228
    True. WHat you could do is this to run the batch.
    VB Code:
    1. Sub RunBatch(BatchFile As String)
    2.  Dim x() As String, y As String
    3.  Open BatchFile For Input As #1
    4.  y = Input(LOF(1), 1)
    5.  Close #1
    6.  x = Split(y, vbNewLine)
    7.  For i = 0 To Ubound(x)
    8.   Shell x(i)
    9.  Next i
    10. End Sub
    Try that.
    Luke

  9. #9
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    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.

  10. #10
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    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.

  11. #11

    Thread Starter
    Fanatic Member Stevie's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    565
    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
  •  



Click Here to Expand Forum to Full Width