w10install/06_Copy2Media.cmd

114 lines
2.5 KiB
Batchfile
Raw Permalink Normal View History

2020-12-25 20:08:46 +01:00
@echo off
2023-01-02 17:15:02 +01:00
set W10=c:\TEMP\W10
set SOURCES=%W10%\sources
2023-02-07 16:39:44 +01:00
set BOOTFILE=boot.wim
set IMAGEFILE=install.wim
set SCRIPT_SETTINGS=scripts\settings.cmd
set COMPANY_SETTINGS=company\settings.cmd
2020-12-25 20:08:46 +01:00
2021-03-18 00:08:40 +01:00
IF %1.==. GOTO USAGE
2021-03-17 00:22:50 +01:00
echo.
2023-01-02 17:15:02 +01:00
echo =================================
2023-02-20 10:35:26 +01:00
echo Copying all data to Media ...
2023-01-02 17:15:02 +01:00
echo =================================
echo.
2020-12-25 20:08:46 +01:00
2023-02-20 10:35:26 +01:00
set DRIVE=%1
2021-01-10 00:22:42 +01:00
2023-02-20 10:35:26 +01:00
if /I %DRIVE% == C: (
echo ERROR: cannot use drive %DRIVE% !
2021-01-10 15:49:37 +01:00
exit /b
)
2023-02-20 10:35:26 +01:00
if NOT EXIST %DRIVE% (
echo ERROR: drive %DRIVE% not found!
2021-01-10 00:22:42 +01:00
exit /b
)
2023-02-20 10:35:26 +01:00
echo using drive [ %DRIVE% ] ...
2023-02-08 22:48:50 +01:00
echo.
2023-02-07 16:39:44 +01:00
if NOT EXIST %SOURCES%\%BOOTFILE% (
echo DOH! no %BOOTFILE% in [ %SOURCES% ] found
2022-06-08 19:58:48 +02:00
exit /b
)
2021-03-17 13:05:50 +01:00
2023-02-07 16:39:44 +01:00
if NOT EXIST %SOURCES%\%IMAGEFILE% (
echo DOH! no %IMAGEFILE% in [ %SOURCES% ] found
2023-02-20 10:35:26 +01:00
exit /b
2020-12-25 20:08:46 +01:00
)
rem =====
rem MAIN
rem =====
2023-02-20 10:35:26 +01:00
echo copying all files in [ %W10% ] to drive %DRIVE% ...
robocopy %W10%\ %DRIVE% /MIR /256 /NDL /R:1 /J /XX
2023-01-02 17:15:02 +01:00
rem check for existence of install.wim in case FAT32 was chosen ...
if NOT EXIST %DRIVE%\sources\%IMAGEFILE% (
echo ERROR ON COPY: no %IMAGEFILE% in [ %DRIVE%\sources\%IMAGEFILE% ] found!
echo HINT: FAT32 cannot handle files larger 4 GB!
exit /b
)
:CONT
2021-01-12 17:01:34 +01:00
if EXIST tools (
2021-03-31 14:49:02 +02:00
echo.
2023-02-20 10:35:26 +01:00
echo copying folder [ tools ] to drive %DRIVE% ...
robocopy tools %DRIVE%\tools /COPY:DT /FFT /XO /256 /NJH /NJS /NDL /R:1 /XF .gitignore
2021-01-12 17:01:34 +01:00
)
2021-03-28 18:19:09 +02:00
if EXIST software (
echo.
2023-02-20 10:35:26 +01:00
echo copying folder [ software ] to %DRIVE%\tools ...
robocopy software %DRIVE%\tools\software /COPY:DT /FFT /XO /MIR /256 /NJH /NJS /NDL /R:1 ^
2023-02-08 22:48:50 +01:00
/XF *.iso /XF *.txt /XF *.cmd /XF *.csv /XF .gitignore /XD .git
2021-03-28 18:19:09 +02:00
)
2023-01-01 18:04:13 +01:00
for %%P in (drivers scripts source optional personal company apps) do (
2021-01-10 15:49:37 +01:00
if EXIST %%P (
2021-01-10 23:14:52 +01:00
echo.
2023-02-20 10:35:26 +01:00
echo copying folder [ %%P ] to %DRIVE%\tools ...
robocopy %%P %DRIVE%\tools\%%P /COPY:DT /FFT /XO /MIR /256 /NJH /NJS /NDL ^
2023-02-08 22:48:50 +01:00
/R:1 /XF .gitignore /XD .git
2021-01-10 15:49:37 +01:00
)
)
2021-01-10 23:14:52 +01:00
echo.
2023-02-20 10:35:26 +01:00
echo copying autoconfig starter script to %DRIVE% ...
copy /Y image\StartAutoConfig.cmd %DRIVE%\
2021-03-17 00:22:50 +01:00
2022-06-18 10:41:57 +02:00
echo.
2023-02-20 10:35:26 +01:00
echo putting copytools script to %DRIVE% ...
copy /Y image\CopyTools.cmd %DRIVE%\
2022-06-18 10:41:57 +02:00
rem remove hidden attribute from tools folder ...
attrib -H %DRIVE%\tools
echo.
rem remove passwords from settings.cmd config files ...
for %%A in (
%DRIVE%\tools\%SCRIPT_SETTINGS%
%DRIVE%\tools\%COMPANY_SETTINGS%
) do (
if EXIST %%A (
tools\searchreplace %%A "^.*SET.*LOCALADMIN_PASSWORD.*=.*" "set localadmin_password=DELETED"
)
)
echo.
2023-01-02 17:15:02 +01:00
echo ======
echo READY.
echo ======
2021-01-10 15:49:37 +01:00
GOTO END
:USAGE
2023-02-20 10:35:26 +01:00
echo "usage: %0 <DRIVE>"
2021-02-24 22:26:55 +01:00
echo.
2021-01-10 15:49:37 +01:00
:END