本帖最后由 pcl_test 于 2016-7-15 20:41 编辑
1`每个目录占用的空间
- @echo off
- for /f "tokens=*" %%b in ('dir') do echo "%%b"|find "个文件">nul&&for /f "tokens=3*" %%c in ("%%b") do echo 当前目录 %%c %%d
- for /f %%a in ('dir/ad/s/b') do for /f "tokens=*" %%b in ('"dir %%a\"') do echo "%%b"|find "个文件">nul&&for /f "tokens=3*" %%c in ("%%b") do echo %%a %%c %%d
- pause
复制代码
2`全盘删除所有文件夹下的_desktop.ini
- @echo off
- setlocal enabledelayedexpansion
- for /f "delims=\" %%i in ('fsutil fsinfo drives^|find /v ""') do (
- set var=%%i
- set drive=!var:~-2!
- fsutil fsinfo drivetype !drive!|find "固定">nul && del /a /f /s !drive!\_desktop.ini
- )
- pause
复制代码
3`输出倒文
- @echo off
- :star
- set Output=
- set /p Enter=请输入:
- :Start
- if not "%Enter%"=="" (
- set Output=%Output%%Enter:~-1%
- set Enter=%Enter:~0,-1%
- goto :Start)
- echo.
- echo %Output%
- pause >nul&goto :Star
复制代码
4`百度关键字搜索
- @echo off
- set a=
- set/p a=请输入关键字……
- start http://www.baidu.com/s?wd=%a%
复制代码 5`检查网络信息- @echo off
- netsh -c interface dump >网络信息.txt
- :loop
- cls
- set a=
- set/p a=1……查看网络信息,2……重新设置,Q……退出
- if "%a%"=="1" start 网络信息.txt
- if "%a%"=="2" netsh -f c:\gongsi.txt
- if "%a%"=="q" exit
- goto loop
复制代码
6`中文显示ping结果
- @echo off
- color f2
- echo.
- set for=于
- set of=的
- set with=用
- set in=(以
- set data:=数据
- set milli-seconds:=毫秒为单位)
- set Approximate=大约
- set times=时间:
- set round=来回
- set trip=行程
- set Reply=应答
- set from=来自
- set bytes=字节
- set time=时间:
- set timed=时间
- set out=超过
- set statistics=统计
- set Packets:=包:
- set Sent=已发送=
- set Received=已收到=
- set Lost=已丢失=
- set loss)=丢失)
- set Minimum=最小值=
- set Maximum=最大值=
- set Average=平均值=
- set TTL=TTL=
- setlocal enabledelayedexpansion
- set a=
- set/p a=请输入要ping的网址或IP
- for /f "delims=" %%i in ('ping %a%') do (
- set ret=
- for %%a in (%%i) do if defined %%a (set ret=!ret!!%%a!) else set ret=!ret! %%a
- if not "!ret!"=="" (set ret=!ret:time=时间! && echo !ret!) else echo.
- )
- pause>nul
复制代码
7`显示自己的IP
- @echo off
- for /f "tokens=15" %%i in ('ipconfig ^| find /i "ip address"') do set ip=%%i
- echo %ip%
- pause
复制代码
8`显示网络配置
- @echo off
- :: 代码编写:3742668 代码修订:namejm www.cn-dos.net
- ::调用格式:
- call :select "ip address" "ip"
- call :select "Physical Address" "mac"
- call :select "Default Gateway" "gateway"
- call :select "DNS Servers" "dns"
- call :select "Description" "netcard"
- :: 演示效果
- echo IP:%ip%
- echo MAC:%mac%
- echo DNS:%dns%
- echo GATEWAY:%gateway%
- echo NETCARD:%netcard%
- pause>nul
- goto :eof
- ::**************************************************************
- :: 解析ipconfig命令输出通用函数
- ::**************************************************************
- :select
- for /f "tokens=2 delims=:" %%i in ('ipconfig /all ^| findstr /i /c:%1') do if not "!%~2!" == "" set "%~2=%%i"
- goto :eof
复制代码
9`查看进程使用的端口
- @echo off
- color 1f
- Title XP端口-进程查询
- setlocal enabledelayedexpansion
- echo ╔- -╗
- echo 本机开放的端口及使用该端口的进程
- echo ╚- -╝
- echo ------------------------------------
- echo 端口号 进程名称
- ECHO TCP协议:
- ::利用netstat命令找出使用TCP协议通信的端口,并将结果分割;
- ::将第二个参数(IP加端口)传给%%i,第五个参数(PID号)传给%%j;
- for /F "usebackq skip=4 tokens=2,5" %%i in (`"netstat -ano -p TCP"`) do (
- call :Assoc %%i TCP %%j
- echo !TCP_Port! !TCP_Proc_Name!
- )
- ECHO UDP协议:
- for /F "usebackq skip=4 tokens=2,4" %%i in (`"netstat -ano -p UDP"`) do (
- call :Assoc %%i UDP %%j
- echo !UDP_Port! !UDP_Proc_Name!
- )
- echo 按任意键退出
- pause>nul
- :Assoc
- ::对%1(第一个参数)进行分割,将第二个参数传给%%e。在本程序中,%1即为上面的%%i(形式为:IP:端口号)
- for /F "tokens=2 delims=:" %%e in ("%1") do (
- set %2_Port=%%e
- )
- :: 查询PID等于%3(第三个参数)的进程,并将结果传给变量?_Proc_Name,?代表UDP或者TCP;
- for /F "skip=2 usebackq delims=, tokens=1" %%a in (`"Tasklist /FI "PID eq %3" /FO CSV"`) do (
- ::%%~a表示去掉%%a外面的引号,因为上述命令的结果是用括号括起来的。
- set %2_Proc_Name=%%~a
- )
复制代码
10`自动改回baidu主页
- reg add "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /v "Start Page" /t reg_sz /d http://www.baidu.com /f
- reg add "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /v "Default_Page_URL" /t reg_sz /d http://www.baidu.com /f
- pause
- =====================
复制代码
11`列举进程
- @echo for each ps in getobject _ >ps.vbs
- @echo ("winmgmts:\\.\root\cimv2:win32_process").instances_ >>ps.vbs
- @echo wscript.echo ps.handle^&vbtab^&ps.name^&vbtab^&ps.executablepath:next >>ps.vbs
- cscript //nologo ps.vbs & del ps.vbs
- pause
复制代码
12`取得硬盘数
- @echo off
- cd.>script.txt
- >>script.txt echo list disk
- for /f %%i in ('diskpart /s script.txt^|find /c ^"联机^"') do Set HardDrivers=%%i
- del script.txt /q
- echo 您的计算机上硬盘安装数量为:%HardDrivers%
- pause
复制代码
13`显示当前用户名
- @echo off
- echo 所有用户帐号ID为:
- echo.
- for /f "skip=4 tokens=1-3" %%i in ('net user') do (
- if not "%%i"=="命令成功完成。" echo %%i
- if not "%%j"=="" echo %%j
- if not "%%k"=="" echo %%k
- )
- echo.
- echo 当前用户帐号ID为:%username%
- pause>nul
复制代码
14`使用WMI别名获取CPU信息
- ::使用WMI别名获取PC主要信息.bat
- ::使用WMI别名获取主要信息,输出为网页格式
- ::--------by MOBO[墨伯] at 2006-09-16:
- wmic baseboard list brief /format:hform >MyPC.htm
- wmic cpu list full /format:hform >>MyPC.htm
- wmic bios list brief /format:hform >>MyPC.htm
- MyPC.htm
复制代码
15`判断分区格式
- @echo off
- :1
- cls
- set/p pan=请输入要测试的盘符 (不带冒号)
- for /f "tokens=1,2" %%i in ('chkntfs %pan%:') do (
- set var=%%j
- goto type
- )
- goto :eof
- :type
- set var=%var:。=%
- echo %pan%的文件系统类型是 %var%
- pause>nul
- goto 1
复制代码
16`更改系统启动菜单的时间
- @echo off
- set/p time=请输入您想要的启动时间
- c:
- type boot.ini>boot.bak
- attrib -h -r -s boot.ini
- type boot.bak|find "boot loader" /i>boot.ini
- echo timeout=%time% >>boot.ini
- type boot.bak|find "boot loader" /i /v|find "timeout" /i /v>>boot.ini
- attrib +s +r +h boot.ini
复制代码
17`更改盘符
- @echo off
- color f4
- echo 特别提醒! 请不要修改C: !&PAUSE>NUL
- COLOR 07
- cls
- set/p a=请输入原盘符……
- set/p b=请输入新盘符……
- set old=%a%:
- set new=%b%:
- pushd %new% 2>nul && echo %new%盘已经存在! && pause && goto :eof
- for /f %%i in ('mountvol %old% /l') do set "vol=%%i"
- mountvol %old% /d
- mountvol %new% %vol%
- popd
复制代码
18`winxp修改计算机名
- @echo off
- set /p name=请输您的计算机名:
- reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName" /v ComputerName /t reg_sz /d %name% /f
- reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v "NV Hostname" /t reg_sz /d %name% /f
- reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v Hostname /t reg_sz /d %name% /f
复制代码
19`改变我的文档路径D
- reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Personal /t reg_expand_sz /d "d:\My Documents" /f
复制代码
20`xp下确定最后的盘符
- @echo off
- for %%i in (Z Y X W V U T S R Q P O N M L K J I H G F E D C) do (
- if exist %%i:\nul (
- for /f "tokens=3" %%j in ('dir /-c %%i:\') do set freesize=%%j
- set last=%%i
- if not "!freesize!"=="0" goto last_drive
- )
- )
- goto :eof
- :last_drive
- echo 最后一个分区是 %last%
- md %last%:\001
- pause
- ===============
复制代码
21`右键添加bat
- @echo off
- reg add HKCR\.bat\ShellNew /v nullfile /f >nul
- reg add HKCR\batfile /ve /d testbat /f >nul
复制代码
22`右键添加打开MS-DOS
- reg add "HKCR\*\shell\ms-dos" /ve /d ms-dos /f
- reg add "HKCR\*\shell\ms-dos\command" /ve /d "cmd.exe /k cd %%1" /f
- reg add "HKCR\Folder\shell\ms-dos" /ve /d ms-dos /f
- reg add "HKCR\Folder\shell\ms-dos\command" /ve /d "cmd.exe /k cd %%1" /f
复制代码
23`显示扩展名
- reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v HideFileExt /t reg_dword /d 00000000 /f
复制代码
24`显示隐藏文件
- reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v Hidden /t reg_dword /d 1 /f
- reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v HideFileExt /t reg_dword /d 0 /f
- reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v ShowSuperHidden /t reg_dword /d 1 /f
复制代码
25`WIN2003 IIS最小权限分配
- @echo off
- echo "虚拟主机C盘权限设定"
- echo "Author:an85.com"
- echo "删除C盘的everyone的权限"
- cd/
- cacls "%SystemDrive%" /r "everyone" /e
- cacls "%SystemRoot%" /r "everyone" /e
- cacls "%SystemRoot%/Registration" /r "everyone" /e
- cacls "%SystemDrive%/Documents and Settings" /r "everyone" /e
- echo "删除C盘的所有的users的访问权限"
- cd/
- cacls "%SystemDrive%" /r "users" /e
- cacls "%SystemDrive%/Program Files" /r "users" /e
- cacls "%SystemDrive%/Documents and Settings" /r "users" /e
- cacls "%SystemRoot%" /r "users" /e
- cacls "%SystemRoot%/addins" /r "users" /e
- cacls "%SystemRoot%/AppPatch" /r "users" /e
- cacls "%SystemRoot%/Connection Wizard" /r "users" /e
- cacls "%SystemRoot%/Debug" /r "users" /e
- cacls "%SystemRoot%/Driver Cache" /r "users" /e
- cacls "%SystemRoot%/Help" /r "users" /e
- cacls "%SystemRoot%/IIS Temporary Compressed Files" /r "users" /e
- cacls "%SystemRoot%/java" /r "users" /e
- cacls "%SystemRoot%/msagent" /r "users" /e
- cacls "%SystemRoot%/mui" /r "users" /e
- cacls "%SystemRoot%/repair" /r "users" /e
- cacls "%SystemRoot%/Resources" /r "users" /e
- cacls "%SystemRoot%/security" /r "users" /e
- cacls "%SystemRoot%/system" /r "users" /e
- cacls "%SystemRoot%/TAPI" /r "users" /e
- cacls "%SystemRoot%/Temp" /r "users" /e
- cacls "%SystemRoot%/twain_32" /r "users" /e
- cacls "%SystemRoot%/Web" /r "users" /e
- cacls "%SystemRoot%/WinSxS" /r "users" /e
- cacls "%SystemRoot%/system32/3com_dmi" /r "users" /e
- cacls "%SystemRoot%/system32/administration" /r "users" /e
- cacls "%SystemRoot%/system32/Cache" /r "users" /e
- cacls "%SystemRoot%/system32/CatRoot2" /r "users" /e
- cacls "%SystemRoot%/system32/Com" /r "users" /e
- cacls "%SystemRoot%/system32/config" /r "users" /e
- cacls "%SystemRoot%/system32/dhcp" /r "users" /e
- cacls "%SystemRoot%/system32/drivers" /r "users" /e
- cacls "%SystemRoot%/system32/export" /r "users" /e
- cacls "%SystemRoot%/system32/icsxml" /r "users" /e
- cacls "%SystemRoot%/system32/lls" /r "users" /e
- cacls "%SystemRoot%/system32/LogFiles" /r "users" /e
- cacls "%SystemRoot%/system32/MicrosoftPassport" /r "users" /e
- cacls "%SystemRoot%/system32/mui" /r "users" /e
- cacls "%SystemRoot%/system32/oobe" /r "users" /e
- cacls "%SystemRoot%/system32/ShellExt" /r "users" /e
- cacls "%SystemRoot%/system32/wbem" /r "users" /e
- echo "添加iis_wpg的访问权限"
- cacls "%SystemRoot%" /g iis_wpg:r /e
- cacls "%SystemDrive%/Program Files/Common Files" /g iis_wpg:r /e
- cacls "%SystemRoot%/Downloaded Program Files" /g iis_wpg:c /e
- cacls "%SystemRoot%/Help" /g iis_wpg:c /e
- cacls "%SystemRoot%/IIS Temporary Compressed Files" /g iis_wpg:c /e
- cacls "%SystemRoot%/Offline Web Pages" /g iis_wpg:c /e
- cacls "%SystemRoot%/System32" /g iis_wpg:c /e
- cacls "%SystemRoot%/Tasks" /g iis_wpg:c /e
- cacls "%SystemRoot%/Temp" /g iis_wpg:c /e
- cacls "%SystemRoot%/Web" /g iis_wpg:c /e
- echo "添加iis_wpg的访问权限[.net专用]"
- cacls "%SystemRoot%/Assembly" /g iis_wpg:c /e
- cacls "%SystemRoot%/Microsoft.NET" /g iis_wpg:c /e
- echo "添加iis_wpg的访问权限[装了MACFEE的软件专用]"
- cacls "%SystemDrive%/Program Files/Network Associates" /g iis_wpg:r /e
- echo "添加users的访问权限"
- cacls "%SystemRoot%/temp" /g users:c /e
复制代码
26`弹出光驱
- mshta "javascript:new ActiveXObject('WMPlayer.OCX').cdromCollection.Item(0).Eject();window.close();"
复制代码
27`查看驱动器
- @echo off
- setlocal enabledelayedexpansion
- for /f "skip=1 tokens=1,2 delims=\" %%a in ('fsutil fsinfo drives^|find /v ""') do (
- set aa=%%a
- set aa=!aa:~-2!
- for %%i in (!aa!) do fsutil fsinfo drivetype %%i
- )
- pause
复制代码
28`win2000关机命令
- @echo off
- setlocal
- cd/d %temp%
- echo Set colOperatingSystems = GetObject("winmgmts:{(Shutdown)}").ExecQuery("Select * from Win32_OperatingSystem") >shutdown.vbs
- echo For Each objOperatingSystem in colOperatingSystems >>shutdown.vbs
- echo ObjOperatingSystem.Win32Shutdown(12) >>shutdown.vbs
- echo Next >>shutdown.vbs
- cscript shutdown.vbs
- del shutdown.vbs
- ::;Value Meaning
- ::;0 Log Off
- ::;0 + 4 Forced Log Off
- ::;1 Shutdown
- ::;1 + 4 Forced Shutdown
- ::;2 Reboot
- ::;2 + 4 Forced Reboot
- ::;8 Power Off
- ::8 + 4 Forced Power Off
- pause
复制代码
29`查看工作组
- @echo off
- title 查看工作组
- color f2
- net config workstation
- pause >nul
复制代码
30`刷新策略
- gpupdate.exe /force
- ======================
复制代码
31`判断光驱里有无光盘
- @echo off
- if exist I:\nul.ext (echo 有光盘) else (echo 无光盘)
- pause>nul
复制代码
32`判断光驱是否可用
- @echo off
- copy [url=file://\\.\CdRom0\]\\.\CdRom0\[/url]* nul >nul 2>nul && echo OK || echo 不可用
- pause
复制代码
33`禁止保留文档记录
- REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /V NORECENTDOCSHISTORY /T REG_DWORD /D 1 /F
复制代码
34.根据文件名移动文件到文件夹
- ::mp3文件名命名方式【欢子-伤心的时候可以听情歌】把欢子的所有mp3移动到欢子文件夹下
- @echo off
- for %%a in (*.mp3) do for /f "tokens=1,2 delims=-." %%b in ("%%a") do (
- if not exist %%b\ md %%b\
- move "%%a" %%b\
- )
复制代码
35.启动UCDOS,进入WPS
用edit编辑a.bat文件,输入下列内容后存盘为c:\a.bat,执行该批处理文件后可实现:将根目录中所有文件写入 a.txt中,启动UCDOS,进入WPS等功能。
批处理文件的内容为: 命令注释:
@echo off 不显示后续命令行及当前命令行
dir c:\*.* >a.txt 将c盘文件列表写入a.txt
call c:\ucdos\ucdos.bat 调用ucdos
echo 你好 显示"你好"
pause 暂停,等待按键继续
rem 准备运行wps 注释:准备运行wps
cd ucdos 进入ucdos目录
wps 运行wps
(1)增加可执行文件路径addpath.bat- @echo off
- if "%1"==""goto end
- if " %path% ==""goto next
- path %path%;%1
- goto end
- :next
- path %1
- :end [/size]
复制代码 或者用path1.bat- @echo off
- rem path1.bat
- rem 本程序的调用格式:
- rem PATH1 newdir
- set path=%1;%path%
复制代码 也可以用 pa.bat- @set path=%path%path%path%;%1
复制代码 (2)显示文件使用信息dosxx.bat- @echo off
- echo exe,com文件使用信息文件
- echo 格式 :dosxx *.exe(com)
- echo off
- for %%a in(%1) do %%a/?>>txt
复制代码 (3)显示日期和时间dt.bat- @echo |more|date
- @echo |more|time
-
- [color=blue](4)fm.bat[color=black]
- cls
- cd\work
- dir>ls
- c:\dos\sort<ls
- del ls*
- pause
- c:\cced\cced
复制代码 (5)拷贝隐含文件hcopy.bat- @echo off
- attrib -h %1
- copy %1 %2
- attrib +h %1
- echo on
复制代码 (6)删除隐含文件hdel.bat- @echo off
- attrib -h %1
- del %1
- echo on
复制代码 (7)显示隐含文件内容htype.bat- @echo off
- attrib -h %1
- copy/b %1 con
- attrib +h %1
- @echo on
复制代码 (8)拷贝多个文件manycopy.bat- @echo off
- ATTRIB +A \*.*/S
- :TOP
- xcopy \*.* A:/m/s>NUL
- GOTO END
- ECHO PUT A NEW FORMATTED BLANK DISK IN %1,THEN
- PAUSE
- GOTO TOP
- :END
复制代码 (9)同时建立多个目录md-many.bat- @for %%f in(%1 %2 %3 %4 %5 %6 %7 %8 %9)do md %%f
- 或者用
- @echo off
- if "%1"= =goto help
- :next
- echo md %1%
- md %1
- shift
- if "%1"= =goto end
- goto next
- :help
- echo 同时建立多个子目录
- echo 使用格式:md-many 目录名1 目录名2…
- echo 使用举例:md-many c:\a d:\b
- :end
复制代码 (10)同时删除多个文件mdel.bat- @echo off
- del %1
- if not "%2"==""del %2
- if not "%3"==""del %3
- if not "%4"==""del %4
- if not "%5"==""del %5
- if not "%6"==""del %6
- if not "%7"==""del %7
- if not "%8"==""del %8
- if not "%9"==""del %9
- echo on
复制代码 (11)同时查看多个目录mdir.bat- @echo off
- if not "%1"= =""dir %1
- if not "%2"= =""dir %2
- if not "%3"= =""dir %3
- if not "%4"= =""dir %4
- if not "%5"= =""dir %5
- if not "%6"= =""dir %6
- if not "%7"= =""dir %7
- if not "%8"= =""dir %8
- if not "%9"= =""dir %9
- if "%1"= =dir
- echo on
复制代码 (12)目录改名ml-gm.bat- @echo off
- md %2
- attrib -h-s/s%1\*.*
- xcopy %1 %2/s
- deltree/y %1
复制代码 (13)将任意数量的文件拷贝到一个指定的目录中 mycopy.bat- @echo off
- rem mycopy.bat 的功能是将任意数量的文件拷贝到一个指定的目录中
- rem 本程序的调用格式如下:
- rem mycopy yourdir file1 file2 file3…
- set todir=%1
- :getfile
- shift
- if "%1%=="" goto end
- copy %1 %todir%
- goto getfile
- :end
- set todir=
- echo (All done !)
复制代码 (14)同时播放多个自显示图形文件 play.bat- @echo off
- @pic1.exe /fad /dis /w10
- @pic2.exe /fad /dis /w5
- @pic3.exe /fad /dis /w5
复制代码 (15)快速、彻底删除文件 qdel.bat- @echo off
- @echo 删除文件qdel *.*
- for %%a in (%1) do copy nul %%a>nul
复制代码 (16)多个文本联接一起tlink.bat- @echo off
- @echo 连接文本文件内容
- @echo 格式 tlink *.*
- for %%a in (%1) do type %%a>>TXT
复制代码 (17)显示多个文本文件内容 typesy.bat- @echo off
- rem 显示通配文本批文件内容
- echo 格式:typesy *.*
- for %%a in (%1) do type %%a
复制代码 (18)打印多个文本 typrn.bat- @echo 打印文本文件内容
- @echo 格式:typrn *.*
- for %%a in (%1) do copy %%a prn
复制代码 (19)隐含文件改名 wj-gm.bat- @echo off
- attrib -h %1
- ren %1 %2
- attrib +h %1
- echo on
复制代码 (20)显示文本内容 xtype.bat- @echo off
- copy/b %1 con
- @echo on
复制代码 (21)转换磁盘后直接进入目录 mcd.bat- @echo off
- for %%x in(A: a: B: b: C: c: D: d: E: e:)do if %%x==%1 goto next
- goto next1
- :next
- %1
- cd\
- shift
- :next1
- cd %1
- if "%1"==""goto help
- goto end
- :help
- echo 转换磁盘与改变当前目录同时进行
- echo 使用格式:mcd 盘符 路径
- echo 使用举例:mcd a: \bb\bbb
- :end
复制代码 (22)删除多个内有各种属性文件的目录 mrd.bat- @echo off
- if "%1"==""goto help
- :next
- echo rd %1
- attrib -s -r -h %1\*.*
- echo y\del %1>nul
- rd %1
- dir %1
- shift
- if "%1"==""goto end
- goto next
- :help
- echo 删除多个内有文件的目录
- :end
复制代码 (23)改变多个目录下的文件属性 mattrib.bat- @echo off
- for %%x in (+r -r +s -s +h -h +a -a)do if %%x==%1 goto next
- goto next1
- :next
- set sx=%1
- shift
- :next1
- echo attrib %sx% %1
- attrib %sx% %1
- if "%1"==""goto end
- goto next1
- :help
- echo 改变多个目录下的文件属性
- echo 使用格式:attrib1 文件属性 目录名1 目录名2…
- echo attrib1 +r \dos\*.* \ucdos\*.com
- :end
- set sx=
复制代码 (24)多个文件同时改名 mren.bat- @echo off
- if "%1"==""goto help
- :next
- echo ren %1 %2
- ren %1 %2
- shift
- if "%1"==""goto end
- goto next
- :help
- echo 多个文件同时改名
- :end
- [/color][/color][/color][/color][/color][/color][/color]
复制代码 更新中..................
[ 本帖最后由 jikea 于 2010-12-12 09:57 编辑 ] |