DOS-Gurus, Batch File question

I want to create a batch file to auto-update software when the version number on the users computer grows old. I can do all the file transfers just fine with a batch file (using ftp etc) but my problem is I dont know how to determine if the version is old or not. I need to check the version against a ver file on my ftp server but nothing I try seems to work!

I originally thought to download the ver file and then use the "<" operator to pipe in the ver number as a parameter to my batch file but this doesnt work (the input doesnt happen). So....any ideas would be greatly appreciated.


Comments

  • : I want to create a batch file to auto-update software when the version number on the users computer grows old. I can do all the file transfers just fine with a batch file (using ftp etc) but my problem is I dont know how to determine if the version is old or not. I need to check the version against a ver file on my ftp server but nothing I try seems to work!

    : I originally thought to download the ver file and then use the "<" operator to pipe in the ver number as a parameter to my batch file but this doesnt work (the input doesnt happen). So....any ideas would be greatly appreciated.<br>
    :



    -------



    I suggest that you create a dummy 1k file on the

    server which contain a timestamp of the file that you want to update.



    then, each time that you want to check for a new version, you download this 1k file, use the command FC, which is file compare, to compare the previous timestamp with the one of the newest file. If errorlevel tell you that the file is not equal or one file is missing, then it's time to upgrade.



    it will work perfectly...










  • : I want to create a batch file to auto-update software when the version number on the users computer grows old. I can do all the file transfers just fine with a batch file (using ftp etc) but my problem is I dont know how to determine if the version is old or not. I need to check the version against a ver file on my ftp server but nothing I try seems to work!

    : I originally thought to download the ver file and then use the "<" operator to pipe in the ver number as a parameter to my batch file but this doesnt work (the input doesnt happen). So....any ideas would be greatly appreciated.<br>


    Since batch files can only really compare text, you will probably have to enlist the help of another program. How about this: Write a program that reads in a version number from a downloaded file from the server and compares it against the local version definition file. If the version on the server is newer have the program return a positive return value (which the batch file tests), if it is older, return a negative one, if the same, return 0.



    -Xotor-




  • : Since batch files can only really compare text, you will probably have to enlist the help of another program.



    the FC dos command can compare both text & binary.

    So it can be used. And if binary files are different than you can be certain that they are not the same version.



    BTW You're suggestion would also work perfectly.




  • I figured out a workaround which isnt as elegant as the timestamp method but works...

    I download the version file then use "copy bat1+version" to append the version number as a parameter to a batch file call in bat1. This works well but takes 3 batch files to accomplish.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories