首页 > 代码库 > 我的作品
我的作品
1. 根据输入数字算年龄
@echo off
color 9f
title Game by Frank
::mod col=80
setlocal enabledelayedexpansion
echo This game is to get your age according to the entered number.
set /p FirstNumber=Please enter the first number that you have thought already :
set /a Result=(2*%FirstNumber%+5)*50
::echo !Result!
set /p BirFlag=Whether your birthday has been already passed or not? (Y/N) :
IF /i %BirFlag%=="Y" (set /a Result=!Result!+1766) ELSE (set /a Result=!Result!+1765)
set /p DOB=Please enter your birthday (yyyy) :
set /a Result=!Result!-%DOB%
set /a FirstNumber=!Result!/100
set /a Age =!Result!%%100
::echo !Result!
echo The number you chose : !FirstNumber!
echo And your age : !Age!
::echo on
::FOR /l %%i in (1,1,3) do (@echo )
echo %0 Thank you for running this game, and enjoy yourself^^!
pause>nul
2.递归某个 srcFolder 递归拷贝其下面所有子文件夹中的文件
@echo off
title copy files (*.*) from source folder( actutally it‘s sub-folder recursively) to target folder by Frank v1.2
color 1f
mode con cols=115 lines=25
setlocal EnableDelayedExpansion
set /p srcFolder= Please enter the src folder:
set /p tarFolder= Please enter the tar folder:
for /f "delims=" %%i in (‘dir /ad /b /s !srcFolder!‘) do copy "%%i"\*.* !tarFolder!\
::copy !srcFolder!\%%i\*.* !tarFolder!\
pause
3. 拷贝并重命名文件
@echo off
title FrnkCopyFilesAndRename 1,2,3......
color 9f
mode con cols=60 lines=20
setlocal enabledelayedexpansion
set var=0
set SrcFolder="C:\Users\Ghc\Desktop\Mydir\"
set regRule="*.txt"
for %%i in (%SrcFolder%%regRule%) do (
set /a var=!var!+1
copy %%i %SrcFolder%new2\!var!.txt
)
echo All the files have been copied successfully!
pause>nul
4、双击开仨QQ
@echo off
Title StartQQ3Timesbat
color 27
mode 60,80
for %%i in (1,1,3) do "F:\Program Files (x86)\Bin\QQScLauncher.exe"
5、网络磁盘映射
@echo off
rem my bat script start
Title NetDiskBat
Color 27
Mode 40,20
net use w: \\192.168.0.5\newshare\
echo Congratulations! New Share Folder has been set as local driver w!!!
pause>nul
删除网络磁盘映射
net use w: /del
6、输出特殊字符
@echo off
rem set color
color 24
title Frank batch script
echo ^^ ^> ^>^> ^& ^&^& ^| ^|^|
echo Press any key to exit&pause>nul
7. 选择分支
@echo off
setlocal enabledelayedexpansion
set /p a=Do you love me? (Y/N)
if /i !a!== y echo mee too
pause>nul
8. 循环分支
@echo off
setlocal enabledelayedexpansion
set var=0
for /l %%i in (1,1,10) do (
set /a var=%%i+!var!
set /a tem2=!var!
set /a tem1=%var%
echo tem1:%tem1% tem2:!tem2! var:!var!
)
pause>nul
9.批处理设置 Wlan
@echo off
netsh wlan set hostednetwork mode=allow
netsh wlan set hostednetwork ssid=WiFi key=12345678
:+ ssid=无线名称 key=密码8位以上 这里都自己设置吧
netsh wlan start hostednetwork
net start ALG
net start BFE
net start MpsSvc
echo 已开启!
pause
我的作品
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。