标题: 20元求助两个bat 复制所有盘一级和二级目到txt和一个加水印 [打印本页]
作者: 464700366 时间: 2020-10-14 17:07 标题: 20元求助两个bat 复制所有盘一级和二级目到txt和一个加水印
需要复制盘符里所有文件夹的一级和二级目录到txt
没有二级目录的就只复制一级目录
盘符需要哪个可以直接添加或减少,所有内容都复制到一个txt里
格式如下
D/视频/漫威
D/视频/动漫
E/资料
E/软件
第二个是加水印
水印位置可以选择四个角和中心,水印图片可以设置个完整路径,吧bat放到需要加水印的文件夹中,保存带水印的图片到当前文件夹的新建文件夹中,如果带目录的话原目录也要带上。
可以写的留个联系方式
作者: zaqmlp 时间: 2020-10-14 17:59
本帖最后由 zaqmlp 于 2020-10-17 15:30 编辑
第一个- @echo off
- cd /d "%~dp0"
- set "txtfile=xxx.txt"
- type nul>"%txtfile%"
- for %%a in (C D E F) do (
- if exist %%a:\ (
- echo;%%a Searching……
- (for /f "delims=" %%b in ('dir /ad/b "%%a:\" 2^>nul') do (
- echo;%%a/%%b
- for /f "delims=" %%c in ('dir /ad/b "%%a:\%%b\" 2^>nul') do (
- echo;%%a/%%b/%%c
- )
- ))>>"%txtfile%"
- )
- )
- pause
- exit
复制代码
第二个
convert.exe
http://bcn.bathome.net/tool/ImageMagick,6.9.2-6/convert.exe- @echo off
- cd /d "%~dp0"
- rem 水印位置,0为中心,1为左上角,2为右上角,3为左下角,4为右下角
- set direction=1
-
- set "oldfolder=."
-
- set "newfolder=.\新建文件夹"
-
- set "logopic=.\水印.png"
-
- set "exefile=.\convert.exe"
-
- if not exist "%newfolder%" md "%newfolder%"
- if not exist "%oldfolder%" (echo;"%oldfolder%" not found&pause&exit)
- if not exist "%logopic%" (echo;"%logopic%" not found&pause&exit)
- if not exist "%exefile%" (echo;"%exefile%" not found&pause&exit)
-
- if "%oldfolder:~-1%" equ "\" set "oldfolder=%oldfolder:~,-1%"
- if "%newfolder:~-1%" equ "\" set "newfolder=%newfolder:~,-1%"
- set gravity=Center
- if "%direction%" equ "1" set gravity=northwest
- if "%direction%" equ "2" set gravity=northeast
- if "%direction%" equ "3" set gravity=southwest
- if "%direction%" equ "4" set gravity=southeast
- for /f "delims=" %%a in ('dir /a-d/b "%oldfolder%\*.jpg"') do (
- echo;"%%a"
- "%exefile%" "%oldfolder%\%%~nxa" "%logopic%" -gravity %gravity% -geometry +3+3 -composite "%newfolder%\%%~nxa"
- )
- :end
- pause
- exit
复制代码
作者: Batcher 时间: 2020-10-17 14:30
回复 1# 464700366
请参考Q-04把 加水印图片.bat 文件保存为ANSI编码:
https://mp.weixin.qq.com/s/6lbb97qUOs1sTyKJfN0ZEQ- @echo off
- set "wmflag=top-left"
- REM set "wmflag=top-center"
- REM set "wmflag=top-right"
- REM set "wmflag=center-left"
- REM set "wmflag=center"
- REM set "wmflag=center-right"
- REM set "wmflag=bottom-left"
- REM set "wmflag=bottom-center"
- REM set "wmflag=bottom-right"
- set "wmfile=C:\Users\Administrator\Desktop\Watermark.jpg"
- set "NewFolder=新建文件夹"
-
- cd /d "%~dp0"
- if not exist "%NewFolder%" (
- md "%NewFolder%"
- )
- for /f "delims=" %%i in ('dir /b /a-d *.jpg') do (
- nconvert -wmflag %wmflag% -wmfile "%wmfile%" -out jpeg -o ""%NewFolder%"\%%i" "%%i"
- )
复制代码
nconvert下载地址:
http://bcn.bathome.net/s/tool/index.html?key=nconvert
作者: Batcher 时间: 2020-10-17 14:45
回复 1# 464700366
请参考Q-04把 获取文件夹列表.bat 文件保存为ANSI编码:
https://mp.weixin.qq.com/s/6lbb97qUOs1sTyKJfN0ZEQ- @echo off
- set "DriveList=C,D,E"
- set "FolderList=D:\1.txt"
- (for %%i in (%DriveList%) do (
- if exist "%%i:\" (
- for /f "delims=" %%j in ('dir /b /ad "%%i:\"') do (
- for /f "delims=" %%k in ('dir /b /ad "%%i:\%%j" 2^>nul') do (
- echo %%i/%%j/%%k
- )
- )
- )
- ))>"%FolderList%"
复制代码
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |