Ms-Dos - dia de la semana

 
Vista:

dia de la semana

Publicado por josepf (1 intervención) el 20/04/2014 19:26:15
Buenas!

Estoy haciendo .bat para copia de seguridad. Cómo puedo saber el dia de la semana de la fecha actual?

Gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Antoni Masana
Val: 1.419
Oro
Ha mantenido su posición en Ms-Dos (en relación al último mes)
Gráfica de Ms-Dos

dia de la semana

Publicado por Antoni Masana (811 intervenciones) el 14/05/2014 12:22:22
Te pongo este código sacado de otro foro. http://www.computerhope.com/forum/index.php?topic=72724.0

Solo necesitas cortar y pegar la parte que te interese

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
::  Checkinn.bat
::  With thanks to Dias De Verano for his assistance.
 
@echo off & setlocal enabledelayedexpansion
cls
 
:: Create/run vbs file (extracts date components) & set variables..
 
set vbsfile=%temp%\newdate.vbs
echo Newdate = (Date())>%vbsfile%
echo Yyyy = DatePart("YYYY", Newdate)>>%vbsfile%
echo   Mm = DatePart("M"   , Newdate)>>%vbsfile%
echo   Dd = DatePart("D"   , Newdate)>>%vbsfile%
echo   Wd = DatePart("WW"  , Newdate)>>%vbsfile%
echo   Wn = DatePart("Y"   , Newdate)>>%vbsfile%
echo   Ww = datepart("W"   , Newdate)>>%vbsfile%
 
echo Wscript.Echo Yyyy^&" "^&Mm^&" "^&Dd^&" "^&Wd^&" "^&Ww^&" "^&Wn>>%vbsfile%
 
FOR /F "tokens=1-6 delims= " %%A in ('cscript //nologo %vbsfile%') do (
        set weekday#=%%E
	)
 
del %vbsfile% & set vbsfile=
 
 
for /f "tokens=1-3 delims=: " %%A in ('time/t') do (
    set hour=%%A
    set mins=%%B
    set ampm=%%C
)
set hourmins=%hour%%mins%
 
:   Set shift identifier based on time of day:
 
set shift=A
 
if "%ampm%"=="PM" if %hourmins% gtr 0200 if %hourmins% lss 1001 (
   set shift=B & goto next
)
 
if "%ampm%"=="PM" if %hourmins% gtr 1000 if %hourmins% lss 1201 (
   set shift=C & goto next
)
 
if "%ampm%"=="AM" if %hourmins% lss 0401 (
   set shift=C
   set /a weekday# -=1
   if !weekday#! lss 1 set weekday#=7 & goto next
)
 
if "%ampm%"=="AM" if %hourmins% gtr 1159 (
   set shift=C
   set /a weekday# -=1
   if !weekday#! lss 1 set weekday#=7
)
 
:next
 
::  Set alpha day from the week day number:
 
for /f "tokens=%weekday#%" %%a in ("Sun Mon Tues Wed Thu Fri Sat") do (
    set alfaday=%%a
)
 
::  Environment Variables set are:
::  %weekday#% = Day number within week (range 1 thru' 7, Sun is day #1)
::  %alfaday%  = Alpha day (range Sun thru' Sat)
::  %hour%     = Hour of the day
::  %mins%     = Minutes of the hour
::  %ampm%     = AM or PM indicator
::  %shift%    = Shift identity letter ( range A thru C)
 
::  Display for checking purposes:
echo.&echo.&echo.&echo.&echo.&echo.&echo.
echo                        Today's date is %date%
echo                        Current time is %hour%:%mins% %ampm%
echo.
echo                        Day number of week = %weekday#%   Alpha day = %alfaday%
echo.
echo                        AM or PM = %ampm%
echo.
echo                        Hour plus mins = %hourmins%   Shift identifier = %shift%
echo.&echo.
echo                        After checking the displayed output press any key
echo                        to continue...
set shift=
echo.&echo.&echo.&echo.&echo.&echo.&echo.
pause > nul
cls
 
endlocal
exit /b
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

dia de la semana

Publicado por Un informatico bajo linux (paco) (1 intervención) el 01/06/2017 00:54:47
Aqui dejo un enlace compartido a mi carpeta donde dejo un bat con una dll al ejecutar el bat entra en la dll que es una base de datos extensa con las fechas desde 2017 hasta 2042 y con el dia, y con un simple for busca la fecha a la que estamos y imprime el día.
He visto muchos códigos por internet que relían demasiado algo tan sencillo.

Francisco Hernández Santos

https://drive.google.com/open?id=0BxknzUCw4IJtNjkyVkFCQkZhcFk

Para más información o crear algún bat pueden contactar en mi correo.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar