-
Notifications
You must be signed in to change notification settings - Fork 30
/
CopyDsToUsb.bat
40 lines (32 loc) · 1.28 KB
/
CopyDsToUsb.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
@setlocal enableextensions enabledelayedexpansion
@echo off
REM Variables that require updating
SET OsWimName=
SET DrvLetter=F:
REM Optional Variables
REM Set to yes if you wish to delete the Os wims from Usb prior to update
SET DelOsWim=Y
REM Do NOT change these variables
REM Get scriptdir withOUT trailing backslash
SET scriptdir=%~dp0
SET scriptdir=%scriptdir:~0,-1%
SET mountdir=c:\tmpmnt
SET XF="LiteTouchPE*.wim" "*.iso" "*Media*.bat" MDT*.application *Sorter.ps1 CreateISO.bat autorun.inf
SET XD="%scriptdir%\Deploy\Working" "%scriptdir%\Deploy\Captures" "%scriptdir%\Deploy\Operating Systems"
REM Del existing Os Wims if exists, this makes sure that Rc doesn't fail on low disk space check
IF %DelOsWim%=="Y" (
IF EXIST "F:\Deploy\Operating Systems" RD "F:\Deploy\Operating Systems" /S /Q
)
REM Update all content excluding Os Imgs and Boot Imgs
robocopy "%scriptdir%\Deploy" "%DrvLetter%\Deploy" /e /purge /sl /a-:hs /mt /purge /v /fp /eta /xf %XF% /xd %XD%
REM Copy ONLY the desired OS Wim
robocopy "%scriptdir%\Deploy" "%DrvLetter%\Deploy" %OsWimName%*.swm %OsWimName%*.wim /e
REM if error on wim may need to be split to fit on Fat32
IF %ERRORLEVEL% GTR 1 CALL :ERROR "failed(%ERRORLEVEL%) to copy Os image."
echo Script completed with no errors...
pause
exit
:ERROR
echo %1
pause
exit