그래서 제가 여기서하려는 것은 :
지금 제가 가지고있는 것은 다음과 같습니다.
ECHO OFF
COLOR 9E
CLS
:MENU
ECHO(
ECHO( ...............................................
ECHO( Choose month of the year.
ECHO( ...............................................
ECHO(
ECHO 1 - January
ECHO 2 - February
ECHO 3 - March
Echo 4 - April
Echo 5 - May
Echo 6 - June
Echo 7 - July
Echo 8 - August
Echo 9 - September
Echo 10 - October
Echo 11 - November
Echo 12 - December
ECHO 13 - EXIT
ECHO(
SET /P M= Type prefered month, then press ENTER:
IF %M%==1 GOTO JANUARY
IF %M%==2 GOTO FEBRUARY
IF %M%==3 GOTO MARCH
IF %M%==4 GOTO APRIL
IF %M%==5 GOTO MAY
IF %M%==6 GOTO JUNE
IF %M%==7 GOTO JULY
IF %M%==8 GOTO AUGUST
IF %M%==9 GOTO SEPTEMBER
IF %M%==10 GOTO OCTOBER
IF %M%==11 GOTO NOVEMBER
IF %M%==12 GOTO DECEMBER
IF %M%==13 GOTO EOF
:January
cd C:\Users\PC\Desktop\Folder
[I am stuck here]
cls
GOTO MENU
:February
cd C:\Users\PC\Desktop\Folder
[I am stuck here]
cls
GOTO MENU
:MARCH
cd C:\Users\PC\Desktop\Folder
[I am stuck here]
cls
GOTO MENU
:APRIL
cd C:\Users\PC\Desktop\Folder
[I am stuck here]
cls
GOTO MENU
:MAY
cd C:\Users\PC\Desktop\Folder
[I am stuck here]
cls
GOTO MENU
:JUNE
cd C:\Users\PC\Desktop\Folder
[I am stuck here]
cls
GOTO MENU
:JULY
cd C:\Users\PC\Desktop\Folder
[I am stuck here]
cls
GOTO MENU
:AUGUST
cd C:\Users\PC\Desktop\Folder
[I am stuck here]
cls
GOTO MENU
:SEPTEMBER
cd C:\Users\PC\Desktop\Folder
[I am stuck here]
cls
GOTO MENU
:OCTOBER
cd C:\Users\PC\Desktop\Folder
[I am stuck here]
cls
GOTO MENU
:NOVEMBER
cd C:\Users\PC\Desktop\Folder
[I am stuck here]
cls
GOTO MENU
:DECEMBER
cd C:\Users\PC\Desktop\Folder
[I am stuck here]
cls
GOTO MENU
제 문제는 제가 일하고있는 회사가 라이선스가없는 소프트웨어를 사용하지 않는다는 것입니다. 돈을 절약하기 위해 회사 컴퓨터에 7zip을 설치했습니다.
그래서 내 질문은 다음과 같습니다.
추가하는 방법 ALL , 7zip과 아카이브, [월]에서 만든 .file 유형의 파일을이 [MM_YYYY]을 이름을 지정하고 다른 폴더로 이동합니다.
[MM_YYYY]라는 이름의 백업 폴더를 만들고 선택한 달에 해당하는 .file 형식 파일 만 거기에 넣는 방법.
이 스크립트는 귀하의 작업에 적합합니다. dir
실제 폴더 경로로 값을 변경하십시오 . 이 스크립트를 다른 폴더의 test.bat 에 저장 하고 열린 Cmd 프롬프트에서 실행합니다. 스크립트는 날짜 형식을 가정합니다 [DD:MM:YYYY]
. 형식과 함께 사용하려면 [MM:DD:YYYY]
모든 항목에서 0을 3으로 바꾸십시오 !cmon:~0,2!
. 오류가 있으면 알려주세요.
@echo off
setlocal enabledelayedexpansion
set "mes1=Enter the month letter"
set dir=%userprofile%\Desktop\Folder
COLOR 9E
CLS
:MENU
ECHO(
ECHO( ...............................................
ECHO( Choose month of the year.
ECHO( ...............................................
ECHO(
ECHO J - January
ECHO F - February
ECHO M - March
Echo P - April
Echo Y - May
Echo N - June
Echo L - July
Echo U - August
Echo S - September
Echo O - October
Echo V - November
Echo D - December
ECHO X - EXIT
ECHO(
choice /c JFMPYNLUSOVDX /n /m "%mes1%: > " /t 10 /d X
IF %errorlevel% equ 13 (GOTO :end
) else if %errorlevel% LEQ 9 (set i=0%errorlevel%) else (set "i=%errorlevel%")
pushd "%dir%"
for /f "tokens=1,5" %%G in ('dir /o:d /a:-d "%dir%"') do (set cmon=%%G
if "!cmon:~2,1!"=="/" if "!cmon:~0,2!"=="!i!" (set cdir=!cmon:~0,2!-!cmon:~6,4!
(if not exist "!cdir!" md "!cdir!") & copy "%%H" !cdir! >nul))
pushd "!cdir!" & "c:\Program Files\7-Zip\7z.exe" a !cdir!.zip >nul & popd
:end
echo/ & echo All tasks completed
timeout 5 >nul
exit /b
스크립트 작동 방식을 더 잘 이해하려면 부분 문자열 추출을 참조하십시오 .
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다