Sign in with
Sign up | Sign in
Your question

Is this possible with a batch file?

Last response: in Networking
Share
March 27, 2012 6:16:01 AM

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

More about : batch file

March 27, 2012 3:18:45 PM

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.
!