10-04-2025, 03:18 PM
for me, I use follow script in unattend.xml file. this can copy a folder in USB disk to the C dirve. and then, set a command to run the file in this folder after the new system boot up.
content in unattend.xml
content in startcopy.cmd
content in unattend.xml
Code:
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<RunSynchronous>
<RunSynchronousCommand wcm:action="add">
<Order>1</Order>
<Path>cmd /q /c "FOR %i IN (C D E F G H I J K L N M O P Q R S T U V W X Y Z) DO IF EXIST %i:\Drivers\StartCopy.CMD cmd /k %i:\Drivers\StartCopy.CMD"</Path>
</RunSynchronousCommand>
</RunSynchronous>
</component>
content in startcopy.cmd
Code:
@echo off
if exist %systemroot%\Drivers\start.bat exit
:: set USB and location Dir
set USB=%~d0
set FILEDIR=%USB%\Drivers\ShouldBeCopied
set DESTDIR=%systemdrive%\Drivers\
echo "Copy started\r\n"
xcopy /herky %FILEDIR%\*.* %DESTDIR%\
exit