返回列表 发帖

20元求助两个bat 复制所有盘一级和二级目到txt和一个加水印

需要复制盘符里所有文件夹的一级和二级目录到txt
没有二级目录的就只复制一级目录
盘符需要哪个可以直接添加或减少,所有内容都复制到一个txt里
格式如下
D/视频/漫威
D/视频/动漫
E/资料
E/软件

第二个是加水印
水印位置可以选择四个角和中心,水印图片可以设置个完整路径,吧bat放到需要加水印的文件夹中,保存带水印的图片到当前文件夹的新建文件夹中,如果带目录的话原目录也要带上。
可以写的留个联系方式

本帖最后由 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
exitCOPY
第二个

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
exitCOPY
提供bat代写,为你省时省力省事,支付宝扫码头像支付
微信: unique2random

TOP

回复 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"
)COPY
nconvert下载地址:
http://bcn.bathome.net/s/tool/index.html?key=nconvert
我帮忙写的代码不需要付钱。如果一定要给,请在微信群或QQ群发给大家吧。
【微信公众号、微信群、QQ群】http://bbs.bathome.net/thread-3473-1-1.html
【支持批处理之家,加入VIP会员!】http://bbs.bathome.net/thread-67716-1-1.html

TOP

回复 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%"COPY
我帮忙写的代码不需要付钱。如果一定要给,请在微信群或QQ群发给大家吧。
【微信公众号、微信群、QQ群】http://bbs.bathome.net/thread-3473-1-1.html
【支持批处理之家,加入VIP会员!】http://bbs.bathome.net/thread-67716-1-1.html

TOP

返回列表