批处理——xcopy

作者:追风剑情 发布于:2017-8-30 18:06 分类:批处理

示例1

@echo off
set icon36=%cd%\36.png
set icon48=%cd%\48.png
set icon72=%cd%\72.png
set icon96=%cd%\96.png
set icon512=%cd%\512.png

rem 把不同尺寸的icon放到不同的android目录里
set drawable=%cd%\drawable\app_icon.png
set drawable-hdpi=%cd%\drawable-hdpi\app_icon.png
set drawable-ldpi=%cd%\drawable-ldpi\app_icon.png
set drawable-mdpi=%cd%\drawable-mdpi\app_icon.png
set drawable-xhdpi=%cd%\drawable-xhdpi\app_icon.png
set drawable-xxhdpi=%cd%\drawable-xxhdpi\app_icon.png
set drawable-xxxhdpi=%cd%\drawable-xxxhdpi\app_icon.png

rem 前面加个echo f是为了避免询问是文件还是目录
rem 也就是说如果批处理存在询问并让用户选择选项时可以在前面加echo x代表默认选择项
echo f | XCOPY %icon512% %drawable% /Y
echo f | XCOPY %icon72% %drawable-hdpi% /Y
echo f | XCOPY %icon36% %drawable-ldpi% /Y
echo f | XCOPY %icon48% %drawable-mdpi% /Y
echo f | XCOPY %icon96% %drawable-xhdpi% /Y
echo f | XCOPY %icon512% %drawable-xxhdpi% /Y
echo f | XCOPY %icon512% %drawable-xxxhdpi% /Y
@pause

用echo f来自动选择文件,避免用户手动选择

11111.png

@echo off
set org_folder=.\test\org
rem /S递归拷贝 /E空目录也要拷贝 /Y不询问
echo f | XCOPY %org_folder% .\org /S/E/Y
echo copy finished
pause

标签: 批处理

Powered by emlog  蜀ICP备18021003号-1   sitemap

川公网安备 51019002001593号