This should Search for the unique folder name, and set the drive letter as a variable:
<RunSynchronousCommand wcm:action="add">
<Description>Search for the unique folder name, and set the drive letter as a variable</Description>
<Order>1</Order>
<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\Batches setx /m DRIVE=%i:</Path>
</RunSynchronousCommand>
This will "run" the file Directories.cmd:
<RunSynchronousCommand wcm:action="add">
<Order>2</Order>
<Path>cmd /c %USBDRIVE%\Batches\Directories.cmd</Path>
</RunSynchronousCommand>
</RunSynchronous>
What it does do is outputs the letters in the () and burps with a white screen with this code on it:
Windows 11 installation : Has encountered an unexpected error. error code 0x80070001-0x40030 .
The code said it couldn't find a file, what file is it ?? How do I resolve this?
Is it batches directory? or Directories? Which Folder?
TIA John
Directories.cmd