Your proposed method is too complicated. The way most IT folks do this:
Option 1: Using $OEM$ folders
1. Create a normal, updated Windows ISO image.
2. Use Rufus or another tool to write the ISO to an USB drive.
3. Create a new folder
"\sources\$OEM$\$1\Apps"on the same drive.
$1 maps to
C:\, so
$1\Apps is
C:\Apps.
4. Copy your installer files or subfolders into this new folder.
5. When WinPE runs, it will copy everything from
"\sources\$OEM$"to the target folder(s).
6. Since you know where the copied folders are, you can hard-code the RunSynchronous command to "
C:\Apps\installerA.exe"
7. Include a final RunSynchronous command to
rmdir C:\Apps, to clean up the installer folder.
Option 2: Set an environment variable to find the USB's drive letter.
Follow the previous steps 1-2.
3. Create a folder on the USB with an unique name. For example: "
Apps".
4. Add these lines to your unattended file:
Code:
<RunSynchronousCommand wcm:action="add">
<Order>1</Order>
<Description>Search for the unique folder name, and set the drive letter as a variable</Description>
<Path>cmd /c for %i in (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\Apps setx /m USBDRIVE=%i:</Path>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Order>2</Order>
<Path>%USBDRIVE%\folder\installerA.exe</Path>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Order>3</Order>
<Path>%USBDRIVE%\folder\installerB.exe</Path>
</RunSynchronousCommand>
The first command searches through all drive letters (higher than C:), and looks for the drive which contains folder "Apps". Then adds a persistent environment variable with the drive letter. Now you can use that variable in later RunSynchronous commands to to know where the folders are.
This method avoids copying any files, and executes commands directly from the mounted USB drive. You should name the source folder with an unique name, so it doesn't match any other folder which might exist on any of the readable drives.