윈 도 우 이렇게 하면 locked files 도 복사되는 것인가요?
2016.12.06 09:52
훌륭하신 분들로부터 많이 배우고 있습니다.
(1)
Windows에서 복사나 지우기를 하려면 system locked 되었거나 사용 중인 files 인 경우
Administrator's Privilege권한을 얻어도 실행이 안되는데
iperius 프로그램의 경우 Volume Shadow Copy 기능을 활용해서 이를 가능케 하는 옵션도 있더군요.
그런데 아래의 batch file 명령으로 간단하게 할 수 있다고 하는데
고수분께서 한 번 살펴 봐 주시면 감사하겠습니다.
아울러 이보다 더 간편하게 줄일 수는 없는 것인지
좀더 쉬운 script 는 어려울까, 왕초보로서 배우고 싶은 마음 간절합니다.
(2)
그리고 PE 에서 X drive의 windows system drive를 통째로
Wim tool 대신 위의 방식으로 live Windows drive 모두 복사가능할까요?
(사실 PE를 저만의 것으로 설정한 뒤 X drive를 그대로 통째로 복사한 뒤 wim으로 묶고 싶었습니다.)
file은 첨부하였으나 동일 내용을 그대로 복사해 올려 봅니다.
미리 감사의 말씀 드립니다.
-----------
@ECHO OFF
IF NOT "%~1" == "/?" GOTO Main
ECHO Mount Latest Shadow Copy [v1.0]
ECHO Locates the most recent Windows file shadow copy and mounts it to the
ECHO specified directory.
ECHO Copyright (c) 2012, Jason Faulkner - All rights reserved.
ECHO.
ECHO %~n0 MountToFolder [SearchDrive]
ECHO.
ECHO MountToFolder Folder location where the shadow copy contents will be made
ECHO available. This folder should NOT exist; it will be created
ECHO as a mount point and accessible after the operation completes.
ECHO Important Note: The target specified should end with
ECHO a \ character to ensure it is properly read as a directory.
ECHO For example: C:\MyShadowCopy\
ECHO SearchDrive Specifies the local drive for which you want to mount the
ECHO latest shadow copy. Enter with a colon following the drive
ECHO letter. Default value is C:.
ECHO.
ECHO Note: This script MUST be run as Administrator (with highest privledges in a
ECHO scheduled task) in order to work properly.
ECHO.
ECHO Requirements:
ECHO Windows Vista or later with System Restore enabled.
ECHO.
ECHO __________
ECHO Visit my website for additional information, examples and updates.
ECHO https://jasonfaulkner.com
GOTO :EOF
:Main
SETLOCAL EnableExtensions
CALL :Initialize
CALL :Configuration %*
CALL :CheckRequirements
IF %ERRORLEVEL% GTR 0 GOTO Finish
CALL :PrepSettings
IF %ERRORLEVEL% GTR 0 GOTO Finish
REM Pull the shadow copy listing.
VSSAdmin List Shadows %SearchDrive% > %TempFile%
SET ShadowPath=
REM Pull the latest shadow copy from the listing.
FOR /F "usebackq tokens=1,2* delims=:" %%A IN (`FINDSTR /I /C:"Shadow Copy Volume:" %TempFile%`) DO SET ShadowPath=%%B
IF NOT "%ShadowPath%" == "" (
REM A shadow copy was found, mount it.
MKLINK /D "%MountFolder%" %ShadowPath%\
) ELSE (
ECHO No Shadow Copies found.
)
:Finish
IF EXIST %TempFile% DEL %TempFile%
ENDLOCAL
GOTO :EOF
:Initialize
SET MountFolder=
SET SearchDrive=C:
SET TempFile="%TEMP%\%~n0_%RANDOM%.txt"
GOTO :EOF
:Configuration
IF /I "%~1" == "" GOTO InvalidParams
SET MountFolder=%~dp1
IF NOT "%~2" == "" SET SearchDrive=%~2
GOTO :EOF
:PrepSettings
IF EXIST "%MountFolder%" (
ECHO Mount Folder: %MountFolder%
ECHO The specified folder already exists. Enter a new folder for the mount target.
GOTO InvalidParams
)
IF NOT "%SearchDrive%" == "" SET SearchDrive=/FOR=%SearchDrive%
GOTO :EOF
:CheckRequirements
CALL :VerifyRequirement "vssadmin.exe"
GOTO :EOF
:VerifyRequirement
IF EXIST "%~1" GOTO :EOF
IF NOT "%~$PATH:1" == "" GOTO :EOF
ECHO Missing requirement: [%~1] Use /? to view the help information.
EXIT /B 2
:InvalidParams
ECHO Invalid parameters. Use /? to view the help information.
EXIT /B 1
-------------