Batch file checking if an website exist

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
silent
Posts: 44
Joined: 28 Oct 2011 14:40

Re: Batch file checking if an website exist

#16 Post by silent » 06 Apr 2012 07:24

So i understand that the "stats.txt" will be downloaded ?
If its gonna work i will place your name on the credits :D
The stats file is the update or what ?? :D
Idk what downloads what here :D
Ehm,the program just closes itselft after the "logo" (how ever on the forum it says it was downloaded 1 time)

Oh,nvm...Im gonna make it easier by creating a easy website for each update on some free polish shit hosting and its just gonna check if that web exist.

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: Batch file checking if an website exist

#17 Post by abc0502 » 06 Apr 2012 07:53

silent wrote:So i understand that the "stats.txt" will be downloaded ?
If its gonna work i will place your name on the credits :D
The stats file is the update or what ?? :D
Idk what downloads what here :D
Ehm,the program just closes itselft after the "logo" (how ever on the forum it says it was downloaded 1 time)

Oh,nvm...Im gonna make it easier by creating a easy website for each update on some free polish shit hosting and its just gonna check if that web exist.


the file which will be downloaded name it as you wish when it will be downloaded it will be renamed update.txt
the files are downloaded in the %temp% folder, just write %temp% in run and you will get to the folder the window is opend once and then work in the back ground
just make sure that the text in it the same format i explained

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: Batch file checking if an website exist

#18 Post by abc0502 » 06 Apr 2012 08:00

just make sure the download link end with the name of the file uploaded by u
and if u want to but a name but this form after all i just colleted information from here and from the vbsite i mentioned in the code

update.txt contain the current update version for example "update-1.0" and this file exist on your site for direct download put update version in it every time you post new update for the game

ver.txt also contain the current update version but this exist in the game folder on the user pc and always include this file in all of the game update and write the update version on it make it in the main folder of the game or any directory just make the location permannet.

i hope that is clear any question just post it here

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: Batch file checking if an website exist

#19 Post by abc0502 » 06 Apr 2012 08:22

Oh,nvm...Im gonna make it easier by creating a easy website for each update on some free polish shit hosting and its just gonna check if that web exist.

sorry for post again but
how u will modify the batch to check for the new website u will make when the script on players pc this scrip notify them that there is new update u can change the message to tell the "there is new update please check the forum for more details" and put the link of a permanent post make it for the update links only or make it open the post link. and if you don't want them to get annoyed with the message of there is no update a vailable delete this code i can chaneg the code so it start the game instead so when there is update
open the forum page and where is no update open the game diretlly and u can change this batch to exe and put an icon of your game to it so no one know the code or change it

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: Batch file checking if an website exist

#20 Post by abc0502 » 06 Apr 2012 09:17

hay silent i checked the website u should put the update.txt in the main directory in the server i think with the index.html page
so the link should end up like that "http://codealphazero.freeforums.org/update.txt"
and if the update .txt couldn't be downloaded chaneg the update.txt with update.html and when it will be downloaded the name will change to txt and u can edit the html with notepad just write the update-x.x in it and that should fix every thing

silent
Posts: 44
Joined: 28 Oct 2011 14:40

Re: Batch file checking if an website exist

#21 Post by silent » 06 Apr 2012 12:32

Its very easy...i dont need to modify the code after a update. How ?

Code: Select all

@echo off
pushd "%temp%"
set /p version= <ver.txt
(...)
echo CHECKING FOR UPDATES...
>nul 2>&1 ping www.caoupd12.dbv.pl &&goto up1.2 ||goto start
>nul 2>&1 ping www.caoupd13.dbv.pl &&goto up1.3 ||goto start
>nul 2>&1 ping www.caoupd14.dbv.pl &&goto up1.4 ||goto start
>nul 2>&1 ping www.caoupd15.dbv.pl &&goto up1.5 ||goto start
>nul 2>&1 ping www.caoupd16.dbv.pl &&goto up1.6 ||goto start

:start
bla bla bla ...

:up1.2
set /p ver= <ver.txt
if %version% GTR 1.2 goto start
cls
msg * New update is avaiable,check www.codealphazero.freeforums.org download section...
...


And thats all.. (the code checks only for 1.2..i just need to make :up1.3 etc..

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: Batch file checking if an website exist

#22 Post by abc0502 » 07 Apr 2012 02:45

so the update will be end to 1.6, but if there will be more update u will not be able to change this batch and say u made the first website it check for it and then go for the message then when u launch the second website it will not check for it because it check always for the first

silent
Posts: 44
Joined: 28 Oct 2011 14:40

Re: Batch file checking if an website exist

#23 Post by silent » 07 Apr 2012 09:29

Nope,when it will be uptade 1.6 i will add more update links in the game (the update will contain new game file .exe)
And with checking only first one...It checks the ver.txt or i will just make it that if the game version is 1.5 it will just use set ver=1.5 on the start of the game.And when it checks for website,it checks the game version and the one that it checks.If the update will be 1.4 and the game version will be greater than 1.4 it will just goto the other link checking.
Oh i noticed that its gonna be like a loop because its gonna redirect back to the checking and it will check the website and redirect and check again in a loop...
Thats why i will make each update check look like that :

Code: Select all

...
:u1.2
bla bla bla
:u1.3
bla bla
...

And then when the game will check for 1.4 and the version will be greater than 1.4 it will just go to :u1.5 etc..

The updates will be just new mission packs and bug fixes.

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Batch file checking if an website exist

#24 Post by aGerman » 07 Apr 2012 10:35

Well, I assume there is no safe way. What happens if they do a major release and the version jumps from, say, 1.6 to 2.0?
Actually you could read the current version from the extended properties of the exe file (but batch is not suitable to do that :( ). You should search the latest version number in the source text of the index page or another (always same) sub page.

Regards
aGerman

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: Batch file checking if an website exist

#25 Post by abc0502 » 07 Apr 2012 15:08

i hope u make it silent good luck :)

Post Reply