1.

Solve : Is this possible with a batch file??

Answer»

I have a bat file one for every day that runs, with system scheduler, so for each bat file I have to run system scheduler.
Is there a way that I can only run system scheduler one. but the bat file give the day.

How can I do this.

Eg
Here is Day 1 (Busres 1(Mon).bat)

@echo off
net use K: \\172.22.6.36\osback
:: [To Connect(map) K: drive with ip]
cd\
echo off
K:
cd \
Xcopy . /D /I /F /E /Y D:\Backup\Busres\1Mon
net use K: /delete /y
:: [To disconnect the K: Drive]
exit


Here is day 2 Busres 2(Tue).bat

@echo off
net use K: \\172.22.6.36\osback
:: [To Connect(map) K: drive with ip]
cd\
echo off
K:
cd \
Xcopy . /D /I /F /E /Y D:\Backup\Busres\2Tue
net use K: /delete /y
:: [To disconnect the K: Drive]
exit

Can I make one batch file so that it can run on day 1,2,3,4,5,6 and 7.

Thank You
Since you posted this over on the DosTips forums as well I will just quote what they told you over there. Basically comes down to if your regional settings display the Day of the Week with the DATE variable. Otherwise there are ways to get the day of the week with VBscript as well.
Quote from: foxidrive

Yes it is possible but it is specific to your locale and regional settings

When I echo the %date% variable I get this:

CODE: [Select]D:\>echo %date%
Tue 27/03/2012
so I can set a variable to the first token in the %date% variable

Code: [Select]@echo off
for /f "tokens=1" %%a in ("%date%") do set day=%%a
echo %day%
With some extra logic you can add a NUMBER from 1 to 7
There are THIRD party programs that can help you. Or you can make one in C++ or a similar language. Or, just use power shell INSTEAD o batch.

Anyway, here is the concept. Thee is a standard thing the in DOS API that gives you the local date using some numbers instead of words. The days of the week are NUMBERED from 1 to 7, with Sunday being day one.

There is one program that does the following at the command line. I mean I know of one. There are, likely, many others.

SayToday quotelist

It then gives a message from quote list, a text file that is delimited in seven parts. Only the part that is for the current day of week is displayed.

The quote list is often used for a quote of the day for users who sign on to the network. But that message could be sent to a batch file tat will be inked after the SayToday program terminates.
Maybe like this:
Code: [Select]saytoday joblist >job.bat
job
That way job.bat is different each day of the week. Making is different each day of the year would be another task.






Discussion

No Comment Found