1.

Solve : Very Confused By MSDOS (Making Batch Program)?

Answer»

Okay so I'm heavily a Linux user but I'm on Windows right now. I need to build a simple batch program to connect to a webpage a set number of TIMES and save the result in a unique text file each time. If you're more curious, the reason I am trying to do this is for testing of a certain error that only occurs some of the time. I want to figure out how often it occurs, and if there's any pattern to the occurrence (as I hope that may help with fixing it).


So it's like this:

1) GRAB the URL via WGET (I downloaded it for Windows).

2) Rename the file to a unique name and move it into a /output directory.

3) Repeat this indefinitely until I exit the script.


Here's my code so far:


Quote

set UNIQUE=%UNIQUE%1
print %UNIQUE%
wget "http://www.ismywb.com/testt.php?file=http%%3A%%2F%%2Fismywbco%%3APASSWORD%%40IP%%3A2086%%2Fjson-api%%2Flimitbw%%3Fuser%%3Dpavcsbel%%26bwlimit%%3D24000"
rename "[emailprotected]=http%%3A%%2F%%2Fismywbco%%[emailprotected]%%3A2086%%2Fjson-api%%2Flimitbw%%3Fuser=pavcsbel&bwlimit=24000" result%UNIQUE%.txt
move result%UNIQUE%.txt output\result%UNIQUE%.txt

call countup.bat


What happens is it just downloads and nothing is renamed. The file sits with this horribly long name that WGET GIVES it by default.

I had it renaming earlier (can't remember what I changed) however I can't figure out how to increment in MSDOS. It just APPENDS 1s onto the end like this:

result1.txt
result11.txt
result111.txt
...

I want:
result1.txt
result2.txt
result3.txt
...


And yes I've been searching Google endlessly and not having much luck.

I hope someone here can help me who is more familiar with Batch.Is this the aversion you have?
http://www.gnu.org/software/wget/manual/wget.html
FYI thee are a number of GNU things that have been compiled for Windows.
Python is one of many.
http://www.python.org/getit/

I would like to help,
- but long files names give me vertigo.


Discussion

No Comment Found