I'm trying to automate our imaging process. We have multiple computer models with different images all stored on one USB drive with WinPE. I have gotten as far as creating a script that with give me options using Choice
to select which computer I want to image but the problem is that depending on what computer I'm imaging the usb drive's letter changes. I'm looking to create a batch file that will find the USB drive and change the drive letter to say "X:" so that the Choice
script can run properly with a static drive letter to look for the image files.
I search and found a script that will find the USB drive by name "Ace" and output the drive letter but havent been able to figure out how to take that drive and change it to "X:"
for /f "tokens=3 delims= " %%A in ('echo list volume ^| diskpart ^| findstr "Ace"') do (set Acedrive=%%A)
What I have so far is this:
So This basically just gives me options to choose what computer I'm imaging then runs the associated imagex command for that wim. Any help would be greatly appreciated!
Thanks
Give a try this code:
for /f "tokens=2,3 delims= " %%A in ('echo list volume ^| diskpart ^| findstr "Ace"') do (
set Acedrive=%%B
(echo select volume %%A
echo assign letter=X) | diskpart
)
hope you find it helpfull.