백업 디렉토리가있는 모든 디렉토리를 반복하고 배치 된 X 일보다 오래된 파일을 제거하는 배치 파일을 작성하고 싶습니다. 내 스크립트를 실행하고 싶은 컴퓨터에 "forfile"명령이 없습니다. PowerShell이 없으므로 CMD 또는 VBScript가이 작업을 수행하는 유일한 방법 인 것처럼 보입니다.Windows CMD - for 루프 내에서 작동하지 않습니다.
현재 "설정"문에 문제가 있습니다 - 전화 할 때 % checkpath %을 호출 할 때 예상 폴더를받지 못했습니다.
rem we will memorize current directory
pushd %cd%
set folder="C:\Documents and Settings\myname\Desktop"
cd %folder%
rem loop only folders with five chars within their names (unfortunately on less also
for /D %%g in (?????) DO (
set checkpath="%cd%\%%g\backup"
if exist %checkpath% (
for %%a in ('%%g\backup\*.*') do (
set FileDate=%%~ta
set FileDate=%%FileDate:~0,10%%
rem here I want to compare file modification data with current date
)
)
popd
pause
가능한 중복 왜이 배치를 수행
변수가 설정 되어도 변경되지 않습니다?] (https://stackoverflow.com/questions/3949978/why-does-this-batch-variable-never-change-even-when-set) –