Computing.Net > Forums > Programming > Batch File help needed

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to get for your free account now!

Batch File help needed

Reply to Message Icon

Name: RobJN
Date: November 12, 2008 at 06:59:43 Pacific
OS: Windows Vista
CPU/Ram: T7200/2GB
Manufacturer/Model: Novatech
Comment:

Hi all

I'm trying to create a batch file that runs periodically, logging Wireless access points in the vincinity of my laptop and then uploading this log to ftp.

Ideally i want the batch file to first determine whether the computer has internet access and if it does then do the above, if not i want it to record the WAP data in the log. Then next time the batch file runs it will add the more recent data to the log and (if possible) upload to ftp.

So far what i have is:

netsh wlan show networks mode=bssid >E:\test.txt

which detects the local wireless access points but i have no idea how to do the rest as I am a comlete novice to this!

Anyone have any ideas??


Report Offensive Message For Removal

Sponsored Link
Ads by Google

Response Number 1
Name: RobJN
Date: November 12, 2008 at 07:06:45 Pacific
Reply:

If your interested in the background to this question:

I have found a great ruby script that locates Wireless Acess Points returning logitude and latitude (Just like the iphone/ipod touch). I am trying to create a way of tracking my laptop in case it gets stolen. I believe batch files will be best as they run with a default windows install, hence if all my software is wiped of the computer it still has a chance of running (this obviously assumes that the batch file is not deleted too). I've attempted to stop anyone just reinstalling windows by changing BIOS setting to not boot from CD drive (is this good enough?). A better option would be to get this to install even if the os is wiped clean (possibly using techniques used by viruses, MBR?? no idea)

Hope you can help me


Report Offensive Follow Up For Removal

Response Number 2
Name: Holla
Date: November 12, 2008 at 11:39:52 Pacific
Reply:

I used to upload my dynamic IP on an ftp site so that I could connect to that pc remotely.
I think ICQ (The instant messenger) had an option called "run this program when the internet connection is established". I used to misuse this option to run my script and upload the ip info to the ftp site.
This is the batch file used to upload any file to a ftp site with username/password.
Hope this gives ideas on how to do it.


@echo off
if %1a==a goto usage
set datafile=%temp%\fxput.ftp
if exist %datafile% delete %datafile%
echo usename> %datafile%
echo password>> %datafile%
echo cd /www/gm/h/holla>> %datafile%
echo bin>> %datafile%
echo prompt>> %datafile%
echo put %1>> %datafile%
echo quit >> %datafile%
ftp -s:%datafile% the.ftp.site.address
goto quit
:usage
echo Usage:
echo %0 filename
echo will put filename in binary mode onto Holla's web home dir
:quit

--
Holla.


Report Offensive Follow Up For Removal

Response Number 3
Name: RobJN
Date: November 12, 2008 at 13:49:48 Pacific
Reply:

Thanks Holla
I made some good progress today which is good for a complete novice. Still looking for a nice way to test internet connection as to determine whether to upload and delete the local file or just append new info to the local file for uploading later.

Anyone else tried something like this?
please bear in mind that i am completely new to batch programming


Report Offensive Follow Up For Removal

Response Number 4
Name: Holla
Date: November 12, 2008 at 20:49:46 Pacific
Reply:

RobJN,

Not a nice way,
but one crude way to check for internet connection is to get a file thru ftp from a remote server(use the above script, instead of put, use get). If you got the file(If exists filename), connection is there.
If you did not get the file, connection is not established.

If ftping is difficult, just use the wget.exe (GNU) and do "wget http://google.com". If you got the index.html from google, connection exists.

--
Holla.


Report Offensive Follow Up For Removal

Response Number 5
Name: BatchFreak
Date: November 12, 2008 at 21:56:49 Pacific
Reply:

or just use ping, and if you get a connection it exists.

I only Batch if possible, 2000 more lines of code, oh well.


Report Offensive Follow Up For Removal

Related Posts

See More



Response Number 6
Name: RobJN
Date: November 13, 2008 at 06:40:20 Pacific
Reply:

I like that idea Holla,

It doesn't have to be nice, as long as it works and i can figure out how to do it, which for your idea i should be able to figure out pretty easily. Knew their would be a good way of doing this, just needed to think outside of the box.

Thanks again


Report Offensive Follow Up For Removal
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch File help needed

Batch file help needed www.computing.net/answers/programming/batch-file-help-needed/13589.html

DOS Batch File Help? www.computing.net/answers/programming/dos-batch-file-help/15613.html

Batch File Help, 'delete all folder www.computing.net/answers/programming/batch-file-help-delete-all-folder/13383.html