最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Windows系统环境编写DOS批处理文件

运维笔记admin0浏览0评论

Windows系统环境编写DOS批处理文件


​ 今天在Windows系统做网络通信实验,顺便整理一下以前编写的一个批处理的学习菜单文件和一两个批量建立文件夹的文件。功能是根据我个人需要填写的,如果感兴趣的人可以自行修改源程序满足自己的需要。

1. 编写学习菜单, 源代码如下:

@echo off
title 小伟学习课程选择界面
color 0a
mode con lines=15 cols=48
:start
cls

echo=
echo           *******学 习 菜 单*******
echo=
echo              http://phpStudy
echo=
echo              Today:%date:~0,4%年%date:~5,2%月%date:~8,2%日%
            
echo= 
echo   === 1、洛基英语          === 2、Web安全课程
echo=
echo   === 3、打开phpStudy软件  === 4、安全牛课堂
echo=
echo   === 5、退  出              
echo ------------------------------------------------
echo=
set /p var=请输入数字:


if %var% == 1 goto 1
if %var% == 2 goto 2
if %var% == 3 goto 3
if %var% == 4 goto 4
if %var% == 5 goto 5

goto start

:1
start https://student.rockyenglish/login/index
cls
goto start

:2
start http://study.163
cls
goto start

:3
cd d:\phpStudy
start d:\phpStudy\phpStudy.exe
cls
goto start

:4
start https://www.aqniukt
cls
goto start

:5
exit

pause >nul

运行结果如下图:

2. 建立文件夹

在指定路径下按年份月份批量建立文件夹,源码如下:

@echo off
set /p var=请输入系统路径
call %var%
set /p var1=请输入文件夹年份:
set /p var2=请输入文件夹起始月份:
set /p  var3=请输入文件夹终止月份:
for /l %%i in (%var2%,1,%var3%) do md %var1%年%%i月
dir
pause

系统路径指定盘符d盘(也可以指定任意已有的文件夹),年份2022,起止月份1-12

运行结果如下图:

在输入的文件夹名称下按年月批量建立文件夹

源码如下

@echo off
set /p var=请输入系统路径
call %var%
set /p var4=请输入建立的文件夹名称
call md %var4%
call cd \%var4%
set /p var1=请输入文件夹年份:
set /p var2=请输入文件夹起始月份:
set /p  var3=请输入文件夹终止月份:
for /l %%i in (%var2%,1,%var3%) do md %var1%年%%i月
dir
pause

系统路径为d盘,建立新的文件夹名称为liuxiaowei(不存在的文件夹),年份2022,月份1-5月

运行结果如下图:

发布评论

评论列表(0)

  1. 暂无评论
ok 不同模板 switch ($forum['model']) { /*case '0': include _include(APP_PATH . 'view/htm/read.htm'); break;*/ default: include _include(theme_load('read', $fid)); break; } } break; case '10': // 主题外链 / thread external link http_location(htmlspecialchars_decode(trim($thread['description']))); break; case '11': // 单页 / single page $attachlist = array(); $imagelist = array(); $thread['filelist'] = array(); $threadlist = NULL; $thread['files'] > 0 and list($attachlist, $imagelist, $thread['filelist']) = well_attach_find_by_tid($tid); $data = data_read_cache($tid); empty($data) and message(-1, lang('data_malformation')); $tidlist = $forum['threads'] ? page_find_by_fid($fid, $page, $pagesize) : NULL; if ($tidlist) { $tidarr = arrlist_values($tidlist, 'tid'); $threadlist = well_thread_find($tidarr, $pagesize); // 按之前tidlist排序 $threadlist = array2_sort_key($threadlist, $tidlist, 'tid'); } $allowpost = forum_access_user($fid, $gid, 'allowpost'); $allowupdate = forum_access_mod($fid, $gid, 'allowupdate'); $allowdelete = forum_access_mod($fid, $gid, 'allowdelete'); $access = array('allowpost' => $allowpost, 'allowupdate' => $allowupdate, 'allowdelete' => $allowdelete); $header['title'] = $thread['subject']; $header['mobile_link'] = $thread['url']; $header['keywords'] = $thread['keyword'] ? $thread['keyword'] : $thread['subject']; $header['description'] = $thread['description'] ? $thread['description'] : $thread['brief']; $_SESSION['fid'] = $fid; if ($ajax) { empty($conf['api_on']) and message(0, lang('closed')); $apilist['header'] = $header; $apilist['extra'] = $extra; $apilist['access'] = $access; $apilist['thread'] = well_thread_safe_info($thread); $apilist['thread_data'] = $data; $apilist['forum'] = $forum; $apilist['imagelist'] = $imagelist; $apilist['filelist'] = $thread['filelist']; $apilist['threadlist'] = $threadlist; message(0, $apilist); } else { include _include(theme_load('single_page', $fid)); } break; default: message(-1, lang('data_malformation')); break; } ?>