batch file on win7 creates blank log files

Microsoft Windows xp professional editio...
March 29, 2011 at 12:07:10
Specs: Windows 7 PRO 32 or 64, I7 860
I have a batch script to run a FTP transfer of 1 zip each night this has been working great for over a 1 year now and still is on the XP machine but I have moved the files over to a windows 7 machine and the still transfer the zip file and create a log file but it is blank. I have tried this on 3 different windows 7 machines to get same result no matter if the machine is 32 or 64 bit. I would like to get the log file work because as you can see from the batch file listed below once the ftp is done it calls another batch file called blat that emails the contents of the ftplog.txt file to me so that I know the ftp transfer completed.
I added below the contents of my batch file, script file and log file as on the windows XP machine. I have tried coping and recreating the files with same settings on the windows 7 machines and the long that that does not work is I do not see any content in the log file that is created. Any and all help is appreciated with this issue because I am trying to get my email notification back.

Contents of batch file to ftp zip file
ftp -i -s:\ftp.txt 1>c:\logs\ftplog.txt
call c:\blat.bat

Contents of ftp.txt
@ftp -i -s:"%~f0"&GOTO:EOF
open 21
!:--- FTP commands below here ---
cd backups
put "K:\Backups\Daily Offsite Backup\*.zip"

Contents of ftplog.txt
ftp> Invalid command. ftp> @ftp -i -s:"%~f0"&GOTO:EOF
Connected to open 21
220 Serv-U FTP Server v6.0 for WinSock ready...
User (
331 User name okay, need password.
230 User logged in, proceed.
ftp> ftp> !:--- FTP commands below here ---
200 Type set to A.
ftp> cd backups
250 Directory changed to /d:/backups
ftp> put "K:\Backups\Daily Offsite Backup\*.zip"
200 PORT Command successful.
150 Opening ASCII mode data connection for
226 Transfer complete.
ftp: 725717406 bytes sent in 14584.09Seconds 49.76Kbytes/sec. ftp> disconnect
221 Goodbye!
ftp> bye

Thanks again for any Ideas that you may have to resolve this problem

See More: batch file on win7 creates blank log files

Report •

March 30, 2011 at 04:19:04
In the line below, what is the -i doing?
What is the 1 doing?

ftp -i -s:\ftp.txt 1>c:\logs\ftplog.txt

Life is too important to be taken seriously.


Report •

April 3, 2011 at 14:32:42
the script seems to be fine on my system.. Make sure you are running the script as administrator in windows 7 as UAC wont allow the script to write log file in C: drive.
ALso if not needed remove the 1 as M2 suggested..

In your FTP.txt @ftp -i -s:"%~f0"&GOTO:EOF this line is extra, Actually this is needed when you want to turn the ftp.txt itself in a single script.
More info on FTP scripts..

@M2 - I guess the -i is to turn off interactive prompt while the script runs.

Subhash Chandra.

Report •

April 4, 2011 at 06:15:15
I discovered somethis weekend the script and everything workcorrect on the windows xp machine and the windows 7 machine if I create new bat file on the windows 7 machine but if i copy the bat file from windows xp in will not log correctly. which seems weird to me but I know have what I wanted a output file from my ftp so I am happy. It just seems weird that tyou get different behavior from files with exact same contents but if if works that is all that counts. thanks for all of the help

Report •
Related Solutions

Ask Question