2017-04-22 20 views
1

압축 해제 할 RAR 또는 ZIP 아카이브가 많습니다. 일부 보관 파일에는이 폴더에 모든 파일이 포함 된 단일 폴더가 있습니다. 다른 일부 아카이브는 루트 수준의 모든 파일을 가지고 있습니다.아카이브에 RAR/ZIP 압축 풀기가없는 경우 하위 폴더를 만드는 방법은 무엇입니까?

케이스 01

Archive01.rar 
    MyFolder 
     file01.txt 
     file02.txt 
     file03.txt 
     etc. 

케이스 02

Archive02.rar 
    -file01.txt 
    -file02.txt 
    -file031.txt 
    etc. 

나는 하위 폴더로 모든 아카이브를 추출하는 방법을 알고있다.

그러나 아카이브에 존재하지 않는 경우에만 하위 폴더를 만드는 방법은 무엇입니까?

수천 개의 아카이브를 처리하기위한 배치 프로세스 내에서 아카이브 파일이 케이스 01에 속하는 경우 추출시 추가로 폴더를 생성해서는 안됩니다. 그러나 보관 파일이 인 경우 02 추출은 보관 파일 이름의 하위 폴더로 수행되어야합니다.

케이스 01 결과

MyFolder <- Folder 
    file01.txt 
    file02.txt 
    file03.txt 
    etc. 

케이스 02 결과

Archive02 <-Folder base on the archive name 
    -file01.txt 
    -file02.txt 
    -file031.txt 
    etc. 
+0

당신은 무엇을 "뜻뿐만 아니라 때를 만드는 방법 않는다 존재하지 않습니까? " –

+0

아카이브가 "케이스 01"인 경우 폴더를 만들지 않고 "케이스 02"의 경우 모든 파일을 추출 할 폴더를 만듭니다. –

답변

2

콘솔 버전 Rar.exe 명령 l목록 아카이브 파일이 프로그램 파일 폴더에있는 텍스트 파일 Rar.txt에 따른 내용 WinRAR은 콘솔 버전 용 설명서입니다. 명령어 (또는 L)을 사용하여 실행중인 Rar.exe의 목록 출력을 배치 파일에서 처리하여 RAR 아카이브 파일에 상위 디렉토리에 하나의 디렉토리 만 포함하고 다른 디렉토리는 없는지 확인할 수 있습니다. 그러나 Rar.exe은 무료 UnRAR.exe처럼 RAR 아카이브 만 지원합니다.

또한 ZIP 아카이브를 지원하려면 RAR 및 ZIP 아카이브 및 기타 아카이브 유형 추출을 지원하는 GUI 버전 WinRAR.exe을 사용해야합니다. WinRAR.exe에 대한

설명서는 WinRAR과 실행에 대한 메뉴 항목을 메뉴 도움말도움말 항목을 클릭에 열 수 있습니다 의 도움 WinRAR과입니다.도움말 탭 내용 목록 항목 명령 줄 모드 및 명령 줄에서 WinRAR.exe을 실행하기 위해 참조 된 도움말 페이지에 필요한 모든 정보가 있습니다.

그것은WinRAR.exe 것을 때문에 그래픽 사용자 인터페이스 응용되는 콘솔 창에 출력 아카이브 파일의 내용에 명령 l을 지원하지 않습니다 명령의 목록을 찾고 볼 수 있습니다.

따라서 아카이브 파일에 최상위 레벨에 WinRAR.exe을 사용하는 단일 디렉토리 만 있으면 명령 줄이나 배치 파일에서 확인할 수 없습니다.

그러나 파일과 디렉터리 이름에 대한 보관 파일을 먼저 구문 분석 한 다음 명령 줄에 추가 추출 폴더를 지정하지 않고 해당 명령을 사용하여 보관 파일을 추출하는 것은 비효율적이므로 중요하지 않습니다.

그것은 훨씬 더 효율적 처음 추출물 모든 * .RAR (이후 모든 * .ZIP) 스위치 -ad와 한 WinRAR과 호출을 사용하여 파일은 아카이브 파일의 이름을 가진 하위 디렉토리에 각 아카이브 파일을 추출 할 수 두 번째는 해당 압축 파일이 최상위 디렉토리에 단 하나의 디렉토리 만 포함했기 때문에 필요없는 각 추출 디렉토리를 제거합니다.

  1. 작업 디렉토리가 호출에 첫 번째 인수로 지정 될 수 있습니다 추가 기능을 다음이 포함 된 아래

    이 스마트 접근 방식은 잘하면 많은 WinRAR과 사용자에게 유용하도록 배치 파일에 사용되는 심지어 UNC 경로 일 수있는 배치 파일.

  2. 는 배치 파일 (내 모든 컴퓨터에로) 자동으로 WinRAR.exe이 아닌 기본 프로그램 파일 디렉토리에 설치되는 32 비트 또는 64 비트 WinRAR과와 그 사용 사례에 대해서도 작업을 설치된 위치를 알아 낸다.

참고 : 현재 또는 지정된 디렉토리에 기존 아카이브 파일이 이전에 이미 추출 된 경우 아래 게시 주석으로 배치 파일로 확인하지 않습니다. 따라서 한 번 처리 된 아카이브 파일이 해당 디렉토리에서 제거되지 않는 디렉토리에서 배치 파일을 여러 번 실행하는 것은 바람직하지 않습니다. 즉 절대 파일/폴더 이름은 이상 259 개 문자가되고,

@echo off 
rem Change working directory if batch file was started with an argument. 
if not "%~1" == "" (
    pushd "%~1" 2>nul 
    if errorlevel 1 (
     echo Specified directory "%~1" does not exist. 
     echo/ 
     pause 
     goto :EOF 
    ) 
) 

setlocal EnableExtensions DisableDelayedExpansion 

rem Does WinRAR exist in default program files folder? 
set "WinRAR=%ProgramFiles%\WinRAR\WinRAR.exe" 
if exist "%WinRAR%" goto StartExtraction 

rem Does WinRAR exist in default program files folder for x86 applications? 
set "WinRAR=%ProgramFiles(x86%\WinRAR\WinRAR.exe" 
if exist "%WinRAR%" goto StartExtraction 

rem Try to determine installation location of WinRAR.exe from registry. 
set "TypeToken=2" 
goto GetPathFromRegistry 

rem On Windows Vista and later REG.EXE outputs without version info: 

rem HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\WinRAR.exe 
rem (Default) REG_SZ Full path to WinRAR\WinRAR.exe 

rem There are only spaces used to separate value name, value type and value string. 

rem But REG.EXE version 3.0 outputs on Windows XP with version info: 

rem ! REG.EXE VERSION 3.0 
rem 
rem HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\WinRAR.exe 
rem  <NO NAME> REG_SZ Full path to WinRAR\WinRAR.exe 

rem NOTE: There are 4 indent spaces and 2 separating tabs in REG 3.0 output line. 

rem So either token 2 or token 3 contains value type REG_SZ 
rem used to identify the line with the wanted information. 

:GetPathFromRegistry 
for /F "skip=1 tokens=%TypeToken%*" %%A in ('%SystemRoot%\System32\reg.exe QUERY "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\WinRAR.exe" /ve 2^>nul') do (
    if "%%A" == "REG_SZ" (
     if exist "%%~fB" (
      set "WinRAR=%%~fB" 
      goto StartExtraction 
     ) 
    ) else if "%%A" == "NAME>" (
     set "TypeToken=3" 
     goto GetPathFromRegistry 
    ) 
) 

endlocal 
if not "%~1" == "" popd 
echo Could not determine directory containing WinRAR.exe. 
echo/ 
echo Please configure it manually in file: %~f0 
echo/ 
pause 
goto :EOF 


rem WinRAR supports multiple archive types on extraction. 
rem Specify here the archive file extensions for extraction. 

:StartExtraction 
for %%I in (rar zip) do call :ExtractArchives %%I 

rem Restore previous command environment, restore previous current directory 
rem and exit this batch file without fall through to the subroutines below. 
endlocal 
if not "%~1" == "" popd 
goto :EOF 


rem The subroutine ExtractArchives processes all archive files in current 
rem directory with the file extension passed to subroutine as first argument. 

rem WinRAR is called once to extract all files with specified file extension 
rem for extraction into a subdirectory with name of the archive file. 

rem Then one more subroutine is called for each archive file to determine 
rem if it is safe to move the extracted archive file contents up one level. 

:ExtractArchives 
if not exist "*.%~1" goto :EOF 
"%WinRAR%" x -ad -cfg- -ibck -y -- "*.%~1" 
for %%A in ("*.%~1") do call :MoveUpExtracted "%%~nA" 
goto :EOF 

rem The subroutine MoveUpExtracted first checks if for the archive file 
rem passed to the subroutine as first argument a subdirectory exists at 
rem all, i.e. the extraction before was successful for that archive. 

rem Next it counts the subdirectories in the archive extraction directory. 
rem Nothing is moved up if there is more than 1 subdirectory in archive 
rem extraction directory. 

rem Also nothing is moved up if archive extraction directory contains 
rem 1 or more files. 

rem After verification of archive extraction directory really containing 
rem only a single subdirectory and nothing else, the name of the archive 
rem extraction directory is compared case-insensitive with the name of 
rem the single subdirectory in archive extraction directory. On equal 
rem directory names the archive extraction directory is renamed by 
rem appending _tmp to make it possible to move the subdirectory with same 
rem name up one level in directory hierarchy. There is hopefully by chance 
rem never a directory present in current directory with name of an archive 
rem file and _tmp appended. 

rem Next it is checked if in current directory there is not already existing 
rem a directory with name of the subdirectory from extracted archive in which 
rem case it is also not possible to move the directory up one level. In this 
rem special use case the archive extraction directory is kept containing just 
rem a single subdirectory with restoring original directory name. 

rem Then the single subdirectory in archive extraction directory is moved up 
rem one level which is very fast as just the file allocation table is updated 
rem and no data is really moved. 

rem The directory movement could fail if the extracted directory has hidden 
rem attribute set. In this case temporarily remove the hidden attribute, 
rem move the directory up one level in directory hierarchy and set the 
rem hidden attribute again on the directory. 

rem On a succesful moving up of the extracted directory the (renamed) 
rem extraction directory being now empty is deleted as not further needed. 


:MoveUpExtracted 
if not exist "%~1\" (
    echo Error: No folder for archive %~1 
    goto :EOF 
) 

echo Processing archive folder "%~1" 
set FolderCount=0 
set "FolderName=" 
for /F "delims=" %%D in ('dir "%~1\*" /AD /B 2^>nul') do (
    if defined FolderName goto :EOF 
    set /A FolderCount+=1 
    set "FolderName=%%D" 
) 
if not %FolderCount% == 1 goto :EOF 

for /F "delims=" %%F in ('dir "%~1\*" /A-D /B 2^>nul') do goto :EOF 

set "ParentRenamed=0" 
set "ParentFolder=%~1" 
if /I "%~1" == "%FolderName%" (
    ren "%~1" "%~1_tmp" 2>nul 
    if errorlevel 1 (
     echo Failed to rename "%~1" to "%~1_tmp". 
     goto :EOF 
    ) 
    set "ParentFolder=%~1_tmp" 
    set "ParentRenamed=1" 
) 

if exist "%FolderName%" (
    if %ParentRenamed% == 1 ren "%~1_tmp" "%~1" 
    echo Error: Folder exists "%FolderName%" 
    goto :EOF 
) 

move "%ParentFolder%\%FolderName%" "%FolderName%" >nul 2>nul 
if not errorlevel 1 (
    rd "%ParentFolder%" 
    goto :EOF 
) 

%SystemRoot%\System32\attrib.exe -h "%ParentFolder%\%FolderName%" >nul 
move "%ParentFolder%\%FolderName%" "%FolderName%" >nul 
if errorlevel 1 (
    if %ParentRenamed% == 1 (
     ren "%ParentFolder%" "%~1" 
     goto :EOF 
    ) 
) 

%SystemRoot%\System32\attrib.exe +h "%FolderName%" 
rd "%ParentFolder%" 
goto :EOF 

나는 윈도우 95부터 32 비트 윈도우를 사용하고 있습니다,하지만 난 MAX_PATH 제한에 결코 자신을 실행합니다.

아카이브 파일 이름이 매우 길 때 (예 : 파일 이름 + 파일 확장자의 경우 정확하게 256 자) 배치 파일을 다시 작성하는 것은 정말 흥미롭고 시간이 많이 걸리는 문제였습니다.DIR,에 대한 , RD 및 경로에 REN 지원 짧은 8.3 이름과 같은

  1. 일부 명령 : 나는 아래의 배치 파일의 개발 기간 동안

    다음 발견 ATTRIBMOVE과 같은 다른 명령은 경로 만 지원하지만 파일/폴더 이름은 지원하지 않습니다 (적어도 Windows XP에서는).
    따라서 짧은 8.3 이름을 사용하여 폴더를 이동하거나 속성을 변경할 수 없습니다.

  2. 전체 경로가 포함 된 폴더 이름이 259자를 넘으면 상대 폴더 경로 만 사용하여 모든 명령이 실패합니다. 즉, Windows 명령 인터프리터는 먼저 명령을 실행하기 전에 전체 경로로 폴더 이름을 결정합니다. 따라서 현재 디렉토리는 매우 긴 이름을 가진 아카이브를 처리하거나 아주 긴 이름을 가진 디렉토리를 포함하는 짧은 경로를 가져야합니다.

  3. 나는 폴더의 짧은 이름을 얻거나 해당 경로는 상대 폴더 경로는 Windows 명령 인터프리터에 의해 해석 될 때 for /?에 의해 설명뿐 (배치 파일) call /? 또는 %%~fsI에 의해 설명 %~fs1을 사용하는 방법을 알아낼 수 없었다
  4. 즉 경로가없는 폴더의 긴 이름입니다. 디렉토리의 짧은 이름을 얻기 위해 옵션 /X와 DIR 명령 을 실행에

  5. 는 세 번째 열은 짧은 이름과 네 번째 열 긴 이름을 포함합니다. 그러나 세 번째 열의 짧은 이름은 매우 짧은 폴더 이름에서 누락 될 수 있습니다. dir /AD /X는 독일어로 윈도우 XP SP3 x86에서 실행

    Volume in drive C is System 
    Volume Serial Number is 7582-4210 
    
    Directory of C:\Temp\Test 
    
    29.04.2017 22:39 <DIR>      . 
    29.04.2017 22:39 <DIR>      .. 
    29.04.2017 22:39 <DIR>   ARCHIV~1  archive_with_a_very_very_very_..._long_name_1 
    29.04.2017 22:39 <DIR>      Batch 
    29.04.2017 22:39 <DIR>      xyz 
    

    같은 명령 : 독일 NTFS 파티션에서 실행 영어 윈도우 7 SP1 x64의에 dir /AD /X

출력 윈도우 국가 및 언어 설정에서 설정

Datenträger in Laufwerk F: ist TEMP 
Volumeseriennummer: CAA5-41AA 

Verzeichnis von F:\Temp 

29.04.2017 22:39 <DIR>      . 
29.04.2017 22:39 <DIR>      .. 
29.04.2017 22:39 <DIR>   BATCH  Batch 
29.04.2017 22:39 <DIR>      xxx 
29.04.2017 22:39 <DIR>   ARCHIV~1  archive_with_a_very_very_very_..._long_name_1 

주 : 독일 또한 FAT32 파티션은 윈도우 국가 및 언어 설정에서 설정 매우 긴 디렉토리 이름이 여기서 내 이름으로 ...으로 절단되었습니다.

Batch 디렉토리가 Windows XP 컴퓨터의 짧은 이름 BATCH에있는 이유는 무엇입니까?하지만 Windows 7의 짧은 이름은 실제로 설명 할 수 없습니다.

현재 디렉토리의 경로가 짧은 경우 긴 아카이브 이름과 긴 디렉토리 이름을 아카이브에 지원하는 일괄 스크립트입니다. 그것은 확실히 더 나은 것

@echo off 
rem Change working directory if batch file was started with an argument. 
if not "%~1" == "" (
    pushd "%~1" 2>nul 
    if errorlevel 1 (
     echo Specified directory "%~1" does not exist. 
     echo/ 
     pause 
     goto :EOF 
    ) 
) 

setlocal EnableExtensions DisableDelayedExpansion 

rem Does WinRAR exist in default program files folder? 
set "WinRAR=%ProgramFiles%\WinRAR\WinRAR.exe" 
if exist "%WinRAR%" goto StartExtraction 

rem Does WinRAR exist in default program files folder for x86 applications? 
set "WinRAR=%ProgramFiles(x86%\WinRAR\WinRAR.exe" 
if exist "%WinRAR%" goto StartExtraction 

rem Try to determine installation location of WinRAR.exe from registry. 
set "TypeToken=2" 
goto GetPathFromRegistry 

rem On Windows Vista and later REG.EXE outputs without version info: 

rem HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\WinRAR.exe 
rem (Default) REG_SZ Full path to WinRAR\WinRAR.exe 

rem There are only spaces used to separate value name, value type and value string. 

rem But REG.EXE version 3.0 outputs on Windows XP with version info: 

rem ! REG.EXE VERSION 3.0 
rem 
rem HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\WinRAR.exe 
rem  <NO NAME> REG_SZ Full path to WinRAR\WinRAR.exe 

rem NOTE: There are 4 indent spaces and 2 separating tabs in REG 3.0 output line. 

rem So either token 2 or token 3 contains value type REG_SZ 
rem used to identify the line with the wanted information. 

:GetPathFromRegistry 
for /F "skip=1 tokens=%TypeToken%*" %%A in ('%SystemRoot%\System32\reg.exe QUERY "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\WinRAR.exe" /ve 2^>nul') do (
    if "%%A" == "REG_SZ" (
     if exist "%%~fB" (
      set "WinRAR=%%~fB" 
      goto StartExtraction 
     ) 
    ) else if "%%A" == "NAME>" (
     set "TypeToken=3" 
     goto GetPathFromRegistry 
    ) 
) 

endlocal 
if not "%~1" == "" popd 
echo Could not determine directory containing WinRAR.exe. 
echo/ 
echo Please configure it manually in file: %~f0 
echo/ 
pause 
goto :EOF 


rem WinRAR supports multiple archive types on extraction. 
rem Specify here the archive file extensions for extraction. 

rem But first delete temporary folder from a previous breaked execution. 

:StartExtraction 
rd /Q /S # 2>nul 

for %%I in (rar zip) do call :ExtractArchives %%I 

rem Restore previous command environment, restore previous current directory 
rem and exit this batch file without fall through to the subroutines below. 
endlocal 
if not "%~1" == "" popd 
goto :EOF 


rem The subroutine ExtractArchives processes all archive files in current 
rem directory with the file extension passed to subroutine as first argument. 

rem WinRAR is called once to extract all files with specified file extension 
rem for extraction into a subdirectory with name of the archive file. 

rem Then one more subroutine is called for each archive file to determine 
rem if it is safe to move the extracted archive file contents up one level. 

:ExtractArchives 
if not exist "*.%~1" goto :EOF 
"%WinRAR%" x -ad -cfg- -ibck -y -- "*.%~1" 
for %%A in ("*.%~1") do call :MoveUpExtracted "%%~nA" %1 
goto :EOF 

rem The subroutine MoveUpExtracted first checks if for the archive file 
rem passed to the subroutine as first argument a subdirectory exists at 
rem all, i.e. the extraction before was successful for that archive, and 
rem determines short 8.3 name of this directory. 

rem Next it counts the subdirectories in the archive extraction directory 
rem using short directory name. Nothing is moved up if there is more than 
rem 1 subdirectory in archive extraction directory. 

rem Also nothing is moved up if archive extraction directory contains 
rem 1 or more files. 

rem After verification of archive extraction directory really containing 
rem only a single subdirectory and nothing else, the current archive folder 
rem is renamed to # (single character folder name) using short folder name. 

rem This folder rename should work in general. The current archive folder 
rem is kept in case of this folder rename fails unexpected because it is 
rem not yet known if the current directory does not already contain the 
rem single directory extracted from current archive or rename failed 
rem because of a permission or a directory sharing access restriction. 

rem Next it is checked if in current directory there is not already existing 
rem a directory with name of the subdirectory from extracted archive in which 
rem case it is also not possible to move the directory up one level. In this 
rem special use case the archive extraction directory is kept containing just 
rem a single subdirectory with restoring original directory name. In case of 
rem restoring archive directory fails unexpected, the directory with name # 
rem is deleted and the archive is extracted once again into a directory with 
rem name of archive file. 

rem It is clear on this point that the single directory in archive extraction 
rem directory can be moved up to current directory from directory wit having 
rem now the temporary name #. 

rem Moving a directory with command MOVE is not possible if hidden attribute 
rem is set on directory. For that reason it is checked next if the directory 
rem to move up has hidden attribute set using its short directory name. 

rem In case of directory has hidden attribute is indeed set, it is removed 
rem which is also verified. The verification can't be done with errorlevel 
rem evaluation as external command ATTRIB does not set errorlevel on failed 
rem attribute change. So the attribute check is done once again after the 
rem hidden attribute is removed with ATTRIB. 

rem ATTRIB also fails to change the attribute if absolute folder path is 
rem longer than 259 characters. In this case the current extraction folder 
rem with temporary name # is deleted completely and the current archive is 
rem extracted once again to current directory without creation of an 
rem additional directory with name of archive file. 

rem Then the single subdirectory in archive extraction directory having 
rem now name # is also renamed to # using short directory name to avoid 
rem a problem on next command MOVE with an absolute folder path longer 
rem than 259 characters as much as possible. 

rem The directory extracted from archive with name # in directory # is 
rem moved up to current directory with suppressing all errors which could 
rem occur for example if path of current directory plus name of directory 
rem as extracted from archive file is too long. 

rem The directory # in current directory with its subdirectory # is deleted 
rem on a moving error and the current archive file is extracted once again 
rem into current directory without creation of an additional directory with 
rem name of archive file. 

rem But on successful movement of the folder with correct name to current 
rem directory the hidden attribute is set on folder if the extracted folder 
rem has it also set before moving the folder and the finally empty folder # 
rem is deleted before exiting subroutine. 


:MoveUpExtracted 
set "FolderToCheck=%~f1" 
set "FolderToCheck=%FolderToCheck:~0,258%" 
for /F "skip=5 tokens=4*" %%X in ('dir "%FolderToCheck%*" /AD /X 2^>nul') do (
    if "%%Y" == "%~1" set "ArchiveFolder=%%X" & goto Subfolders 
    if "%%Y" == "" if /I "%%X" == "%~1" set "ArchiveFolder=%%X" & goto Subfolders 
) 
echo Error: No folder for archive %~1 
goto :EOF 

:Subfolders 
@echo off 
echo Processing archive folder "%~1" 
set FolderCount=0 
set "FolderName=" 
for /F "delims=" %%D in ('dir "%ArchiveFolder%\*" /AD /B 2^>nul') do (
    if defined FolderName goto :EOF 
    set /A FolderCount+=1 
    set "FolderName=%%D" 
) 
if not %FolderCount% == 1 goto :EOF 

for /F "delims=" %%F in ('dir "%ArchiveFolder%\*" /A-D /B 2^>nul') do goto :EOF 

ren "%ArchiveFolder%" # 2>nul 
if errorlevel 1 (
    echo Error: Failed to rename "%~1" 
    goto :EOF 
) 

set "FolderToCheck=%~dp1%FolderName%" 
set "FolderToCheck=%FolderToCheck:~0,258%" 
for /F "skip=5 tokens=4*" %%X in ('dir "%FolderToCheck%*" /AD /X 2^>nul') do (
    if "%%Y" == "%FolderName%" goto FolderExist 
    if "%%Y" == "" if /I "%%X" == "%FolderName%" goto FolderExist 
) 

set "HiddenFolder=0" 
set "FolderToCheck=%~dp1#\%FolderName%" 
set "FolderToCheck=%FolderToCheck:~0,258%" 
for /F "skip=5 tokens=4*" %%X in ('dir "%FolderToCheck%*" /AD /X 2^>nul') do (
    if "%%Y" == "%FolderName%" set "FolderToMove=%%X" & goto CheckHidden 
    if "%%Y" == "" if /I "%%X" == "%FolderName%" set "FolderToMove=%%X" & goto CheckHidden 
) 

:CheckHidden 
for %%X in ("#\%FolderToMove%") do (
    for /F "tokens=2 delims=h" %%H in ("%%~aX") do (
     if %HiddenFolder% == 1 goto ArchiveExtract 
     set "HiddenFolder=1" 
     %SystemRoot%\System32\attrib.exe -h "#\%FolderName%" 
     goto CheckHidden 
    ) 
) 

ren "#\%FolderToMove%" # 2>nul 
move #\# "%FolderName%" >nul 2>nul 
if errorlevel 1 goto ArchiveExtract 

if %HiddenFolder% == 1 %SystemRoot%\System32\attrib.exe +h "%FolderName%" 
rd # 
goto :EOF 

:ArchiveExtract 
rd /Q /S # 
"%WinRAR%" x -cfg- -ibck -y -- "%~1.%~2" 
goto :EOF 

:FolderExist 
echo Error: Folder exists "%FolderName%" 
ren # "%~1" 2>nul 
if not errorlevel 1 goto :EOF 
rd /Q /S # 
"%WinRAR%" x -ad -cfg- -ibck -y -- "%~1.%~2" 
goto :EOF 

위에 배치 스크립트에서 C 또는 C에서 콘솔 응용 프로그램 ++ 또는 C#되는 긴 경로로 대체 알고 서브 루틴 MoveUpExtracted를 작성합니다.

윈도우 10 버전 1607 (주년 기념 업데이트) 이상 Windows 버전 260 자의 MAX_PATH 제한 (259 개 문자와 널 바이트 종료)에

은 그룹 정책을 통해 또는 레지스트리 값을 추가하여 비활성화 할 수 있습니다 참조

    사용 된 명령을 이해하고 그들이 어떻게 작동하는지, 명령 프롬프트 창을 열고 들어 세르게이 Tkachenko 보낸 월터 글렌

에 의해

  • How to Make Windows 10 Accept File Paths Over 260 Characters에 의해
  • How to enable NTFS Long Paths in Windows 10, 거기에 실행 다음 명령을 사용하고 각 명령에 대해 표시된 모든 도움말 페이지를 매우 신중하게 읽습니다.

    • attrib /?
    • call /?
    • dir /?
    • echo /?
    • endlocal /?
    • for /?
    • goto /?
    • if /?
    • move /?
    • pause /?
    • popd /?
    • pushd /?
    • rd /?
    • reg /?
    • reg query /?
    • rem /?
    • set /?
    • setlocal /?

    읽기는 Microsoft 기사 :

  • +0

    고마워요 !! 그것은 내가 꿈꾸는대로 정확하게 작동합니다 : *) 당신은 내 하루를 만듭니다! –

    -1

    당신은 데이터 폴더 안에 또는 루트에 있는지 확인해야합니다.

    extract to /foldername에 루트의 클릭의 경우 (사례 02)

    그렇지 않으면 그냥 여기 추출 (01 사례)

    enter image description here

    +1

    고마워요.하지만 15000 개의 아카이브를 가지고 손으로 할 수는 없습니다. *) 배치 솔루션이 필요합니다! –