Tom
Wed Jan 30 10:03:12 CST 2008
On Jan 30, 9:17 am, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:
> "Tom Lavedas" <tglba...@cox.net> wrote in message
>
> news:b9f64c2a-1b5e-4e61-8e27-50d25e141556@s13g2000prd.googlegroups.com...
>
>
>
> > On Jan 29, 6:24 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:
> >> "Pete T" <Pe...@discussions.microsoft.com> wrote in message
>
> >>news:5F353EE6-1A67-427C-B108-9A65A1C04438@microsoft.com...
>
> >> >I have a simple batch file that FTP's out to a server, logs in,
> >> >retrieves a
> >> > file and places it on my server and then here's where I run into a
> >> > problem.
>
> >> > When it was written in XP the batch then checked the size of the file
> >> > and
> >> > if
> >> > it was greater than 0, the batch ended and was done. If the file was
> >> > not
> >> > greater than 0, it slept for 20 minutes (echo sleep 1200) and then
> >> > re-ran
> >> > the
> >> > FTP process.
>
> >> > Now that this is on Windows 2000, I can't figure out how to make it
> >> > work.
> >> > Here are the two files that were run:
>
> >> > @echo on
> >> > del para2.txt
> >> > echo open XXXXXXXXXXXXXX >> para2.txt
> >> > echo user XXXXXXXXXXXXXXXXX >> para2.txt
> >> > echo binary >> para2.txt
> >> > echo hash on >> para2.txt
> >> > echo GET XXXXXXXXX >> para2.txt
> >> > echo DEL XXXXXXXXX >> para2.txt
> >> > echo quit >> para2.txt
> >> > progs.bat abc.123.tag
>
> >> > @echo on
> >> > del %1
> >> > :START
> >> > ftp -n -s:para2.txt
> >> > if %~z1 GTR 0 goto :END
> >> > sleep 1200
> >> > goto :START
> >> > :END
> >> > del para2.txt
>
> >> > Any ideas on how to make this work in Windows 2000?
>
> >> Since you're not reporting what exactly happens under
> >> Win2000, it's a little hard to say what's wrong. However,
> >> the batch file below will work both under WinXP and under
> >> Win2000. Note that for ease of maintenance it is now one
> >> single file.
>
> >> @echo off
> >> set FileName=xxxxxxxxx
> >> set Site=ftp.PeteT.com
> >> set User=PeteT
>
> >> echo> para2.txt open %Site%
> >> echo>> para2.txt user %User%
> >> echo>> para2.txt binary
> >> echo>> para2.txt hash on
> >> echo>> para2.txt GET %FileName%
> >> echo>> para2.txt DEL %FileName%
> >> echo>> para2.txt quit
>
> >> if exist %FileName% del %FileName%
> >> :START
> >> ftp -n -s:para2.txt
> >> for %%a in (%FileName%) do if %%~za GTR 0 goto END
> >> ping localhost -n 1200 > nul
> >> goto :START
> >> :end
> >> del para2.txt
>
> > First, not that I am offended by your choosing to answer, but why is
> > this in microsoft.public.scripting.vbscript, since this is entirely a
> > batch command question? I would think alt.msdos.batch.nt would be a
> > better NG or even microsoft.public.windows.server.scripting or
> > microsoft.public.win2000.cmdprompt.admin (though this last one has
> > extremely low activity).
>
> > Second, I think you have probably corrected his problem without
> > explaining why, which I suspect is the missing SLEEP.EXE utility.
> > Since there is no useful error information it's hard to be sure.
> > However, SLEEP is part of the WinNT/2K/XP/2003 Resource Kit and not a
> > standard part of the OS installation, therefore, it is reasonable to
> > assume the OP's XP system has it installed and his 2K machine does
> > not.
>
> > Tom Lavedas
> > ===========
> >
http://members.cox.net/tglbatch/wsh/
>
> As I said, the OP chose not to report any error messages, hence
> it was anyone's guess why his script would fail under Win2000.
> For all I know he might have had one of the countless "sleep"
> utilities on his machine.
However, since the only thing you did different was to substitute the
ping delay for the SLEEP and the OP says it fixed the problem, it
seems to be the issue. While I agree with the combination of the ftp
script into the batch, I don't think that was the problem.
> About answering a batch question in a scripting newsgroup:
> Your point is well taken and I would normally recommend
> that the OP posts his question in the appropriate newsgroup.
> Unfortunately there is no MS-sponsored newsgroup for batch
> file issues, and I hesitate to recommend the one you mention.
> I frequently have a problem with the attitude of some of the
> respondents in that group. Perhaps I'm just a little oversensitive.
I apologize if my response seemed like a criticism. It really wasn't
meant in that vein.
Yes there are some snooty participants at the alt.msdos.batch groups
(as there are most everywhere), but there is a greater number of
helpful batch savvy denizens there, I think. I stayed away for a long
time for the very reasons to which you allude. But, all things
considered, they are probably the last real places to get timely batch
help. Besides, you have taken enough grief here over the past weeks
regarding batch solutions.
The other two MS sponsored groups I mentioned are pretty eclectic,
covering batch issues along with scripts and other topics.
Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/