SpiritOfLennon
IS-IT--Management
Hi,
I'm trying to write code that performs the following function.
1) Checks the version of a program on a server. ( I'm doing this by recording the info in a file )
2) Checks the version of the program being run
3) Compares the two and informs the user if they are running an old version
4) Updates the version of the program they are running
I have managed to write the code except that when running the executeable it obviously doesn't like writing over the program it is currently running. Is it possible to exit the program and kick of the batch file after?
Here is the section of code so far.
'Program to copy new version of program over old version
' Open the "Version" file to get the current version
Open "d:\VB\ejmti\version" For Input As #1
Line Input #1, VersionNumber
Close #1
' Get the current version of the program
VersionNumberUser = App.Major & "." & App.Minor & "." & App.Revision
' Create the copy string in order to update
VersionPath = "copy Y:\ejmti\EJMTI.exe " & App.Path & "\" & App.EXEName & ".exe"
' Test the version number
If VersionNumber <> VersionNumberUser Then
' Inform the user
MsgBox "You are running version " & VersionNumberUser & " There is a new version available"
' Create the batch file for copying the new version
Open "d:\VB\ejmti\version.bat" For Output As #2
Print #2, VersionPath
Close #2
MsgBox "New version " & VersionNumber & " has been copied. Exiting. Please restart"
Exit Sub
End If
SOL
I'm only guessing but my guess work generally works for me.
I'm trying to write code that performs the following function.
1) Checks the version of a program on a server. ( I'm doing this by recording the info in a file )
2) Checks the version of the program being run
3) Compares the two and informs the user if they are running an old version
4) Updates the version of the program they are running
I have managed to write the code except that when running the executeable it obviously doesn't like writing over the program it is currently running. Is it possible to exit the program and kick of the batch file after?
Here is the section of code so far.
'Program to copy new version of program over old version
' Open the "Version" file to get the current version
Open "d:\VB\ejmti\version" For Input As #1
Line Input #1, VersionNumber
Close #1
' Get the current version of the program
VersionNumberUser = App.Major & "." & App.Minor & "." & App.Revision
' Create the copy string in order to update
VersionPath = "copy Y:\ejmti\EJMTI.exe " & App.Path & "\" & App.EXEName & ".exe"
' Test the version number
If VersionNumber <> VersionNumberUser Then
' Inform the user
MsgBox "You are running version " & VersionNumberUser & " There is a new version available"
' Create the batch file for copying the new version
Open "d:\VB\ejmti\version.bat" For Output As #2
Print #2, VersionPath
Close #2
MsgBox "New version " & VersionNumber & " has been copied. Exiting. Please restart"
Exit Sub
End If
SOL
I'm only guessing but my guess work generally works for me.