BatSendMail

@echo off

echo ==================================
echo == Compress Files And Send Mail ==
echo ==================================
echo.
echo.


call :Check "%~1"
echo 1
if not "%TargetPath%"=="" call :SetEnv "%TargetPath%"
goto :eof


:Check
if "%~1"=="" (call :help & goto :eof
)else if "%~1"=="/?" (
call :help & goto :eof
) else (
for /f "tokens=1,* delims=:" %%m in ("%~1") do (
set TargetPath=%%~n
echo %%m
echo %%n
)
goto :eof)
::call :SetEnv %str% & goto :end)


goto :eof

rem 设置所有常量;
:SetEnv
echo SetEnv----------%1
set LOCALPATH=%~1
if not "%LOCALPATH:~-1%"=="" set LOCALPATH=%LOCALPATH%
set LOCAL_TEMP="%LOCALPATH%..TempMail"
md %LOCAL_TEMP%
set CMD_7Z=.software7-Zip7z.exe
set CMD_BLAT=.softwareBlatlat.exe
set MAIL_SMTP_HOST=xxx.xxx.xxx.xxx
set MAIL_SENDER=wei.x.yi@xxx.com
set MAIL_TO=wei.x.yi@xxx.com,qm785462@xxx.com
set MAIL_BODY=""
set MAIL_HEAD=""
goto :eof

:Help
echo /d:[compress path] & goto :eof
echo use /d parameters set compress all path.
echo The path is folder or file.
echo If the path include spase, then use double quotes in this path.
echo.
echo example:
echo   /d:c: emp or /d:c: emp or "/d:C:Program FilesJava"
goto :eof

:end

原文地址:https://www.cnblogs.com/mq0036/p/3473617.html