배치 기준 (14 세) 파일 전에 콘텐츠 삽입

file_exist.bat 문서로 읽고 다음과 같습니다 :
참고 : del /f /q명령은 / f는 힘을 읽기 전용 파일의 제거를 나타냅니다. / q는 확인을 필요로하지 않습니다 글로벌 와일드 카드 문자를 삭제, 조용한 모드를 나타냅니다.

@echo off
if "%1"=="" (
echo 命令用法:
echo %0 fileName
echo fileName 表示要插入内容的文件
echo.
echo 未指定要插入内容的文件,无法执行插入操作!
echo.
goto end
)

if not exist %1 (
echo 指定要插入的%1文件不存在,请仔细检查!
goto end
)

echo 正在进行插入操作......
echo.
echo %date% >> content.txt
echo %time% >> content.txt
copy content.txt + %1 temp.txt > nul
del /f /q %1 > nul
del /f /q content.txt > nul
ren temp.txt %1
echo 成功在%1文件前插入当前日期及时间!
:end

그림 삽입 설명 여기

게시 된 228 개 원래 기사 · 원 찬양 44 ·은 10 만 + 조회수

추천

출처blog.csdn.net/qq_40945965/article/details/86757434