BAT批处理问题

2024-12-31 20:43:58
推荐回答(2个)
回答1:

将以后代码以BAT保存之后放入开始 启动项目即可
@echo off
set sj=%time::=-%
set rq=%date:-=%
md c:\temp
echo >c:\temp\IS%date:~0,-4%_%sj:~0,-2%
echo >c:\temp\ISHIS%date:~0,-4%_%sj:~0,-2%
md d:\temp\%rq:~0,-4%
copy /y c:\temp\IS%date:~0,-4%_%sj:~0,-2% d:\temp\%rq:~0,-4%\IS%date:~0,-4%_%sj:~0,-2%
copy /y c:\temp\ISHIS%date:~0,-4%_%sj:~0,-2% d:\temp\%rq:~0,-4%\ISHIS%date:~0,-4%_%sj:~0,-2%

经测试可行的

回答2:

@echo off
for /f "skip=7 tokens=4" %%a in ('dir C:\temp') do (
set k=%%a
for /f "skip=7 tokens=4" %%b in ('dir D:\temp') do (
set l=%%b
if "%k:~2,4%%k:~7,2%%k:~10,2%"=="%l%" copy %%a\*.* %%b
)
)

LZ试试吧