Is this possible with a batch file?

hendrikbez

Honorable
Mar 22, 2012
5
0
10,510
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
 

tomatthe

Distinguished
You could try using something like this

"Xcopy . /D /I /F /E /Y D:\Backup\Busres\%date:/=%" The auto format is turning it into a smilie, % date : / = % without the spaces.

This should create a folder with "Tue 03272012" for today which I believe would accomplish what you are trying to do.

You may want to try using robocopy, I believe its a bit more efficient then xcopy especially if you are using the multithread switch.