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.
Eg
Here is Day 1 (Busres 1(Mon).bat)
@echo off
net use K: \\000.00.0.00\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: \\000.00.0.00\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
Is this possible with a batch file?
Moderator: DosItHelp
-
- Posts: 20
- Joined: 11 Sep 2008 22:36
Is this possible with a batch file?
Last edited by hendrikbez on 27 Mar 2012 00:58, edited 1 time in total.
Re: Is this possible with a batch file?
Yes it is possible but it is specific to your locale and regional settings
When I echo the %date% variable I get this:
so I can set a variable to the first token in the %date% variable
With some extra logic you can add a number from 1 to 7
When I echo the %date% variable I get this:
Code: Select all
D:\>echo %date%
Tue 27/03/2012
so I can set a variable to the first token in the %date% variable
Code: Select all
@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