첫 번째 파일은 파일 이름 다음 확장으로 분류되어 있습니다 및 폴더 /O:GEN
으로 (중복입니다) 함께 그룹화됩니다. /B
전체 경로는 제외되며 /A-D
폴더는 제외됩니다.
- DIR
- FOR /F
- FILE ATTRIBUTES
:
FOR /F %%J IN ('command') DO (..)
으로 명령 출력의 모든 라인은 일부 링크는
%%~nJ
가 extension.Here없이 파일 이름 만 촬영으로
%%J
variable.And에있는 설정
편집 : 예 :
@echo off
echo %~0 - expands %i removing any surrounding quotes (")
echo %~f0 - expands %i to a fully qualified path name
echo %~d0 - expands %i to a drive letter only
echo %~p0 - expands %i to a path only
echo %~n0 - expands %i to a file name only
echo %~x0 - expands %i to a file extension only
echo %~s0 - expanded path contains short names only
echo %~a0 - expands %i to file attributes of file
echo %~t0 - expands %i to date/time of file
echo %~z0 - expands %i to size of file
echo %~$PATH:0 - searches the directories listed in the PATH environment variable and expands %i to the fully qualified name of the first one found.
echo %~dp0 - expands %i to a drive letter and path only
echo %~nx0 - expands %i to a file name and extension only
echo %~fs0 - expands %i to a full path name with short names only
echo %~dp$PATH:0 - searches the directories listed in the PATH environment variable for %i and expands to the drive letter and path of the first one found.
echo %~ftza0 - expands %i to a DIR like output line
pause
이 파일을 .bat 파일로 저장하십시오. % 0은 .bat 파일이라고하는 경로입니다.이 파일은 모든 % ~ 0 작업을 나열합니다. %~
은 일괄 파일 인수 % 0, % 1 .. 또는 FOR
변수에서만 한쪽 끝에서 작동합니다.
%% ~ nJ는 어떻게 작동합니까? ~ n은 무엇을합니까? – user1667307
변수가 파일 인 경우 한쪽 묶음 변수 (% 0, % 1 ... 또는 FOR 루프의 변수)의 확장자가없는 파일 이름이 필요합니다. 두 번째 또는 세 번째 링크를 참조하십시오 – npocmaka
수정 된 답변을 확인하십시오. – npocmaka