获取时间整点补零
set “year=%date:~0,4%”
set “month=%date:~5,2%”
set “day=%date:~8,2%”
set “hour_ten=%time:~0,1%”
set “hour_one=%time:~1,1%”
set “minute=%time:~3,2%”
set “second=%time:~6,2%”
if “%hour_ten%” == “ “ (
set dateStr=%year%%month%%day%0%hour_one%%minute%%second%
) else (
set dateStr=%year%%month%%day%%hour_ten%%hour_one%%minute%%second%
)
echo %dateStr%
压缩文件
解压缩:
winrar x -ad -ibck *.tar.gz
进程杀掉:
TASKKILL /F /IM WinRAR.exe
文件和文件夹
文件和子文件夹删除:
del *.* /f/s/q/a
for /f “delims=” %%a in (‘dir /ad/b/s d:\cache’) do (rd /q /s “%%a”)>nul
创建和删除文件夹:
mrdir /S /Q example
mkdir example
循环判断
if else/else if 分行需要加^号
常用协议
ssh远程登录linux系统执行命令:
ssh username@server_ip “excute_cmd1;excute_cmd2;excute_cmd3”
ftpput登录ftp服务器放置文件:
ftpput server_ip -u username -p password filename
curl传输文件:
curl -u username:password -T filename ftp://server_ip/