|
Answer» i have a BATCH file which do the ftp and create a log file as ddmmyyhhmiss.txt format to record the ftp log. when i run it manually the log file name generated correctly. but when i use task schedular the the file name saved as ddmmyy, the rest hhmiss.txt is missing.
anny clue?It would help if you showed the exact BAT file. At least the line where you have something like xxxx > %datetime%.log or whatever.
With no data I have no way to test with my scheduler to see what you are talking about.
My guess is that it has NOTHING to do with FTP, so we could test with this bat file:
echo abc > %datetime%.log
(However you create datetime)
Then you are saying that bat file will work fine from the DOS prompt but not via task scheduler.
Need to see that to comment.
Mac Here are the extracts from the batch file: ------------------------------------------------ echo off SET YY=%date:~-4,10% SET DD=%date:~7,-5% SET MM=%date:~4,-8% SET D4=%date:~0,-10% SET HH=%time:~0,2% SET MI=%time:~3,2% SET SS=%time:~6,2% ftp -s:d:\indump\bin\ftpcmnd.txt >d:\indump\log\ftp\[highlight]indump_%YY%%MM%%DD%%HH%%MI%%SS%.txt[/highlight] pause ..
---------------------------------------------------------------------------- when i run it manually the filename becomes like indump_20061103171734.txt
but when it runs from task schedular it becomes like indump_20061106
hope you can help me now...I THINK your problem is that your scheduled time is running when your HH is a single digit padded with a space. I bet if you run it manually before 10 AM you will have the same problem. The way you are filling your variables is strange also. Try this instead: Code: [Select]SET YY=%date:~-4% SET DD=%date:~7,2% SET MM=%date:~4,2% SET D4=%date:~0,3% SET HH=%time:~0,2% SET MI=%time:~3,2% SET SS=%time:~6,2% if %HH% LSS 10 set HH=%HH:~1,1% ftp -s:d:\indump\bin\ftpcmnd.txt >d:\indump\log\ftp\indump_%YY%%MM%%DD%%HH%%MI%%SS%.txt pause ..The "if %hh%..." is to replace the padded space with a padded 0 for single digit HOURS, which I think is your problem.i have changed the system time now and run it manually after including your code. it does not pad with 0 the filename now is like below. indump_2006110685229.txt but i want it to be indump_20061106[highlight]0[/highlight]85229.txtThanx GuruGary, I used this and now its working.
if %HH% LSS 10 set HH=0%HH:~1,1%You got it right. Yes, I had the code, but forgot the 0. Good job.
|