Help with making a batch file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
opalbow
Posts: 1
Joined: 24 Jul 2014 12:22

Help with making a batch file

#1 Post by opalbow » 24 Jul 2014 12:30

hello,

I am new to batch files & need to make one for a project I am doing. I have messed around with them before but that was a few years back so cannot really remember much

I think its a simple task but I have no idea on where to start :D

It simply needs to do the following;

Code: Select all

Ping a known website to check for internet connection (google?)
If ping is good, output to text file that there is internet Else output no internet & exit
Ping a specific FTP server
If ping is good, over ride above text file with the server is there Else over ride above text file with no server & exit
Log into FTP Server
Navigate to Specific Folder
Locate specific file
If folder/file doesnt exist over ride above text file with no file/folder exists and exit
Over ride above text file with download started
Download Specific File
Over ride above text file with download Complete
exit


also if possible It would be great if when the file is run it wouldn't show command prompt up (as I am planning on running this from a program I am making as a background update down-loader


I don't know if the above is fully possible or not so advice & help would be greatly appreciated.

einstein1969
Expert
Posts: 976
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: Help with making a batch file

#2 Post by einstein1969 » 25 Jul 2014 03:26

opalbow wrote:hello,

I am new to batch files & need to make one for a project I am doing. I have messed around with them before but that was a few years back so cannot really remember much

I think its a simple task but I have no idea on where to start :D

It simply needs to do the following;

Code: Select all

Ping a known website to check for internet connection (google?)
If ping is good, output to text file that there is internet Else output no internet & exit
Ping a specific FTP server
If ping is good, over ride above text file with the server is there Else over ride above text file with no server & exit
Log into FTP Server
Navigate to Specific Folder
Locate specific file
If folder/file doesnt exist over ride above text file with no file/folder exists and exit
Over ride above text file with download started
Download Specific File
Over ride above text file with download Complete
exit


also if possible It would be great if when the file is run it wouldn't show command prompt up (as I am planning on running this from a program I am making as a background update down-loader


I don't know if the above is fully possible or not so advice & help would be greatly appreciated.


I don't know but propably there an method different from ping for internet connection detection.

For pinging is better use servers ad hoc?

I don't know but for example is better choice at random from a list

locations.txt

Code: Select all

www.pingtest.net
testmy.net
...
yahoo.com
.....


and check.

This is simple check for examples

Code: Select all

ping -n 1 www.google.it >NUL 2>&1 && echo Internet OK || echo Internet NOK


idem for FTP, but you can use a ftp client.

This is and indication for start!

einstein1969

Post Reply