Problem with my batch files

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
blackgolf
Posts: 7
Joined: 20 Apr 2012 07:20

Problem with my batch files

#1 Post by blackgolf » 20 Apr 2012 07:41

Hi
I have Windows 7 installed with all updates up to date.

I have written 2 different batch files to upload a file to two differnet web servers.
Everything in the 2 files are similar except for the web server address, login name and password.

When running the second file it keeps the log in details and password of the first file - as if the info is in cache.

Here is the code:

@echo off
setlocal
set FILENAME="c:\temp\xyz.gz"
REM The file is located in this folder
rem cd \%PLATFORM%
::Variables
set f=%temp%\ftpc.txt
::Compose ftp commands file
echo open http://www.xyz.co.za>>%f%
echo user username1 password1>>%f%
echo binary>>%f%
REM This is the file you want to upload
echo put %FILENAME%>>%f%
echo bye>>%f%
::Execute ftp command
::Use "-d" key for verbose output
ftp -n -d -s:%f%
endlocal
:END


What am I doing wrong?
Any help will be much appreciated.

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

Re: Problem with my batch files

#2 Post by abc0502 » 20 Apr 2012 08:45

i didn't understand exactly what is the problem but u can have a look at this topic:
http://www.dostips.com/forum/viewtopic.php?f=3&t=2081
and this is samples of ftp scripts:
http://www.dostips.com/DtTipsFtpBatchScript.php

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Problem with my batch files

#3 Post by foxidrive » 20 Apr 2012 09:40

blackgolf wrote:When running the second file it keeps the log in details and password of the first file - as if the info is in cache.

::Compose ftp commands file
echo open http://www.xyz.co.za>%f%

ftp -n -d -s:%f%
del %f% 2>nul

What am I doing wrong?


I suspect the two changes above will help.

blackgolf
Posts: 7
Joined: 20 Apr 2012 07:20

Re: Problem with my batch files

#4 Post by blackgolf » 21 Apr 2012 11:16

You are a S T A R foxidrive, thanks a lot it does the trick.
Regards
Chris

Post Reply