WindowBat实战

  • 自动拷贝文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
@echo off
cls
cd ./bin

REM 打印当前文件夹中的dll名称
dir *.dll

for /r %%j in (*.dll) do (
REM 拷贝Release版的dll到指定目录
echo %%j | find "_d" || xcopy %%j E:path\Release\ /Y
REM 拷贝Debug版的dll到指定目录
echo %%j | find "_d" && xcopy %%j E:path\Debug\ /Y
)

PAUSE
  • 批量自动移动文件并自动建立同名文件夹
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
@echo off
REM 首先遍历最外层的文件夹,
for /f %%i in ('"dir /ad/b/on *.*"') do (
echo "First Dir: %%~fi"
REM MKDIR OF DESTINATION
md E:\Destination\%%i
cd %%~fi
REM 获取到子文件夹之后再递归遍历子文件夹
for /f %%j in ('"dir /ad/b/on *.*"') do (
echo "Second Dir:%%~fj"
REM MKDIR OF DESTINATION
md E:\Destination\%%i\%%j
cd %%~fj
REM 拷贝每个文件到预定的路径中
for %%k in (*.las) do (
echo "Third Dir:%%~fk"
REM COPY EACH LAS FILE
xcopy %%k E:\Destination\%%i\%%j\ /E /D /R /Y
)
REM 返回到上层文件夹,继续后续的遍历
cd ..
)
REM 同理
cd ..
)
REM 脚本运行完之后不退出
pause

WindowBat

bat中的一些语法学习,用于MicroStation多人编译

Parameter Setting

1、系统参数

%SystemRoot% === C:(%windir% 同样)
%ProgramFiles% === C:Files
%USERPROFILE% === C:and Settings(子目录有“桌面”,“开始菜单”,“收藏夹”等)
%APPDATA% === C:and SettingsData
%TEMP% === C:11~1(%TEM% 同样)
%APPDATA% === C:and SettingsData
%OS% === Windows_NT (系统)
%Path% === %SystemRoot%;%SystemRoot%;%SystemRoot%(原本的设置)
%HOMEDRIVE% === C: (系统盘)
%HOMEPATH% === and Settings :: 枚举当前的环境变量

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×