代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
VBS
】
批处理生成日历
作者:
海涛
/ 发布于
2014/10/10
/
1547
@ECHO OFF :: Xp batch for generating calendars :: Chances look good for win 2000 and above(untested) :: By Judago, August 2009 IF "%~1"=="/?" ( ECHO START "%~NX0" WITHOUT ARGUMENTS AND THEN ENTER THE YEAR. ECHO "%~NX0" WILL OPEN IN IT'S OWN WINDOW TO AVOID RESIZING ECHO AN EXISTING WINDOW. ECHO. ECHO A SCREEN RESOLUTION AND/OR FONT SIZE THAT CAN DISPLAY ECHO CMD WINDOWS OF 96 COLUMNS AND 39 LINES IS REQUIRED. ECHO SOME CONFIGURATIONS MAY USE SCROLL BARS TO ACHIEVE ECHO THIS. EXIT /B ) :: The current codepage is stored in variable %CodePage%, :: then changed to 850 to facilitate box drawing characters..... FOR /F "tokens=*" %%A IN ('CHCP') DO FOR %%B IN (%%~A) DO SET CodePage=%%B CHCP 850 >NUL 2>&1 :: The title can be used to falicitate custom window :: positioning via the properties menu of "calendars..." :: /max is used so as much content as possible is visable :: without moving the window. /max must be removed for :: custom window positing..... IF NOT "%~1 %~2"=="WINDOW SIZE" ( START "CALENDARS..." /MAX CMD /C "%~F0" WINDOW SIZE REM Restore the original codepage before exiting..... CHCP %CodePage% >NUL 2>&1 EXIT /B ) MODE CON:COLS=96 LINES=39 SETLOCAL ENABLEDELAYEDEXPANSION :loop FOR %%Z IN (jan feb mar apr may jun jul aug sep oct nov dec year day leap noleap length test) DO SET %%Z= SET /P year=Enter a year to see it's calendar, or nothing to exit, then press enter: IF NOT DEFINED year ( REM Restore the original codepage before exiting..... CHCP %CodePage% >NUL 2>&1 EXIT /B ) ::Test that the input is only numbers... SET test=!year! FOR /l %%Z IN (0 1 9) DO IF DEFINED test SET "test=!test:%%Z=!" IF DEFINED test CLS&GOTO loop :zero IF NOT DEFINED year ( :error cls echo The year entered can not be accepted. echo. pause CLS GOTO loop ) :: remove leading zeros, if any... IF "%year:~0,1%"=="0" SET year=%year:~1%&&GOTO zero :: The %processor_architecture% test is used to test :: limits of caculations, if the variable is undefined :: or unrecognised the test will fall through and complete :: anyway, if the limit is surpassed this way the results may :: not be valid. The tested number is ~80% of the limit of the :: os so that year + year / 4 yields a valid result. IF /I "!processor_architecture!"=="x86" ( IF !year! gtr 1717986917 GOTO :error ) else ( IF NOT "!processor_architecture:64=!"=="!processor_architecture!" ( IF !year! gtr 7378697629483820645 GOTO :error ) ) :: Generate the first day of the year, 0=sun, 1=mon,...,6=sat :: A 365 day year ofsets by one day, so the next year will start :: the next day (i.e. 2009 starts on thr and 2010 starts on fri) :: an extra day must be added for every leapyear. Using modulo :: 7 on the total of offset days reviels the starting day of the :: year. one day must also be removed if the year is a leap year :: because the below will add one for it, the remainder for non :: leap years is not an issue because set /a only returns whole :: numbers. SET /A day=(year + year / 4) - (year / 100 - year / 400) SET /A leap=year %% 400 SET /A noleap=year %% 100 IF !leap! GTR 0 ( IF !noleap! NEQ 0 SET /A leap=year %% 4 ) IF %leap%==0 SET /A day-=1 SET /A day%%=7 :: For each year every month is padded to is starting offset :: with spaces, january has the original offset generated above. :: each additional offset is generated by adding the total days of :: the previous month then processing it by modulo 7. :: The days are stored in a varianle to display later, these variables :: are padded to 111 characters using spaces for display purposes. FOR %%U IN (jan feb mar apr may jun jul aug sep oct nov dec) DO ( FOR %%V IN (jan mar may jul aug oct dec) DO IF /I %%U==%%V SET length=31 FOR %%W IN (apr jun sep nov) DO IF /I %%U==%%W SET length=30 IF /I %%U==feb ( IF !leap!==0 ( SET length=29 ) else ( SET length=28 ) ) FOR /l %%X IN (1 1 !day!) DO SET "%%U=!%%U! " FOR /l %%Y IN (1 1 !length!) DO ( IF %%Y lss 10 ( SET "%%U=!%%U!%%Y " ) else ( SET "%%U=!%%U!%%Y " ) ) FOR /l %%Z IN (!length! 1 54) DO IF "!%%U:~110!"=="" SET "%%U=!%%U! " SET /A day=^(day + length^) %% 7 ) :test :: The results are displayed below using substrings of each month's variable. cls TITLE THE CALENDAR FOR THE YEAR OF %YEAR% echo. 赏屯屯屯屯屯屯屯屯屯突 赏屯屯屯屯屯屯屯屯屯突 赏屯屯屯屯屯屯屯屯屯突 赏屯屯屯屯屯屯屯屯屯突 echo. ? JANUARY ? ? FEBUARY ? ? MARCH ? ? APRIL ? echo. 掏屯屯屯屯屯屯屯屯屯凸 掏屯屯屯屯屯屯屯屯屯凸 掏屯屯屯屯屯屯屯屯屯凸 掏屯屯屯屯屯屯屯屯屯凸 echo. 篠 M T W T F S ? 篠 M T W T F S ? 篠 M T W T F S ? 篠 M T W T F S ? echo. 掏屯屯屯屯屯屯屯屯屯凸 掏屯屯屯屯屯屯屯屯屯凸 掏屯屯屯屯屯屯屯屯屯凸 掏屯屯屯屯屯屯屯屯屯凸 echo. ?JAN:~0,20%? ?FEB:~0,20%? ?MAR:~0,20%? ?APR:~0,20%? echo. ?JAN:~21,20%? ?FEB:~21,20%? ?MAR:~21,20%? ?APR:~21,20%? echo. ?JAN:~42,20%? ?FEB:~42,20%? ?MAR:~42,20%? ?APR:~42,20%? echo. ?JAN:~63,20%? ?FEB:~63,20%? ?MAR:~63,20%? ?APR:~63,20%? echo. ?JAN:~84,20%? ?FEB:~84,20%? ?MAR:~84,20%? ?APR:~84,20%? echo. ?JAN:~105% ? ?FEB:~105% ? ?MAR:~105% ? ?APR:~105% ? echo. 韧屯屯屯屯屯屯屯屯屯图 韧屯屯屯屯屯屯屯屯屯图 韧屯屯屯屯屯屯屯屯屯图 韧屯屯屯屯屯屯屯屯屯图 echo. echo. 赏屯屯屯屯屯屯屯屯屯突 赏屯屯屯屯屯屯屯屯屯突 赏屯屯屯屯屯屯屯屯屯突 赏屯屯屯屯屯屯屯屯屯突 echo. ? MAY ? ? JUNE ? ? JULY ? ? AUGUST ? echo. 掏屯屯屯屯屯屯屯屯屯凸 掏屯屯屯屯屯屯屯屯屯凸 掏屯屯屯屯屯屯屯屯屯凸 掏屯屯屯屯屯屯屯屯屯凸 echo. 篠 M T W T F S ? 篠 M T W T F S ? 篠 M T W T F S ? 篠 M T W T F S ? echo. 掏屯屯屯屯屯屯屯屯屯凸 掏屯屯屯屯屯屯屯屯屯凸 掏屯屯屯屯屯屯屯屯屯凸 掏屯屯屯屯屯屯屯屯屯凸 echo. ?MAY:~0,20%? ?JUN:~0,20%? ?JUL:~0,20%? ?AUG:~0,20%? echo. ?MAY:~21,20%? ?JUN:~21,20%? ?JUL:~21,20%? ?AUG:~21,20%? echo. ?MAY:~42,20%? ?JUN:~42,20%? ?JUL:~42,20%? ?AUG:~42,20%? echo. ?MAY:~63,20%? ?JUN:~63,20%? ?JUL:~63,20%? ?AUG:~63,20%? echo. ?MAY:~84,20%? ?JUN:~84,20%? ?JUL:~84,20%? ?AUG:~84,20%? echo. ?MAY:~105% ? ?JUN:~105% ? ?JUL:~105% ? ?AUG:~105% ? echo. 韧屯屯屯屯屯屯屯屯屯图 韧屯屯屯屯屯屯屯屯屯图 韧屯屯屯屯屯屯屯屯屯图 韧屯屯屯屯屯屯屯屯屯图 echo. echo. 赏屯屯屯屯屯屯屯屯屯突 赏屯屯屯屯屯屯屯屯屯突 赏屯屯屯屯屯屯屯屯屯突 赏屯屯屯屯屯屯屯屯屯突 echo. ? SEPTEMBER ? ? OCTOBER ? ? NOVEMBER ? ? DECEMBER ? echo. 掏屯屯屯屯屯屯屯屯屯凸 掏屯屯屯屯屯屯屯屯屯凸 掏屯屯屯屯屯屯屯屯屯凸 掏屯屯屯屯屯屯屯屯屯凸 echo. 篠 M T W T F S ? 篠 M T W T F S ? 篠 M T W T F S ? 篠 M T W T F S ? echo. 掏屯屯屯屯屯屯屯屯屯凸 掏屯屯屯屯屯屯屯屯屯凸 掏屯屯屯屯屯屯屯屯屯凸 掏屯屯屯屯屯屯屯屯屯凸 echo. ?SEP:~0,20%? ?OCT:~0,20%? ?NOV:~0,20%? ?DEC:~0,20%? echo. ?SEP:~21,20%? ?OCT:~21,20%? ?NOV:~21,20%? ?DEC:~21,20%? echo. ?SEP:~42,20%? ?OCT:~42,20%? ?NOV:~42,20%? ?DEC:~42,20%? echo. ?SEP:~63,20%? ?OCT:~63,20%? ?NOV:~63,20%? ?DEC:~63,20%? echo. ?SEP:~84,20%? ?OCT:~84,20%? ?NOV:~84,20%? ?DEC:~84,20%? echo. ?SEP:~105% ? ?OCT:~105% ? ?NOV:~105% ? ?DEC:~105% ? echo. 韧屯屯屯屯屯屯屯屯屯图 韧屯屯屯屯屯屯屯屯屯图 韧屯屯屯屯屯屯屯屯屯图 韧屯屯屯屯屯屯屯屯屯图 GOTO loop
试试其它关键字
生成日历
同语言下
.
使用脚本将域账号添加到客户机的本地管理员组
.
删除服务器上文件
.
主动ping服务器是否宕机
.
自动 服务器检查 的vbs脚本
.
VBS脚本发送邮件,密送多人,带附件,可更换账号密码
.
根据文件路径复制文件
.
VBA操作数据库
.
双击获取公网IP到剪贴板
.
定时运行ie浏览执行网址不显示浏览器窗口
.
批处理生成日历
可能有用的
.
C#实现的html内容截取
.
List 切割成几份 工具类
.
SQL查询 多列合并成一行用逗号隔开
.
一行一行读取txt的内容
.
C#动态修改文件夹名称(FSO实现,不移动文件)
.
c# 移动文件或文件夹
.
c#图片添加水印
.
Java PDF转换成图片并输出给前台展示
.
网站后台修改图片尺寸代码
.
处理大图片在缩略图时的展示
海涛
贡献的其它代码
(
1
)
.
批处理生成日历
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3