WinPE: Identify drive letters with a script

WinPE drive letter assignments change each time you boot, and can change depending on which hardware is detected.

You can use a script to figure out which drive letter is which by searching for a file or folder.

This sample script looks for a drive that has a folder titled Images, and assigns it to a system variable: %IMAGESDRIVE%.

@echo Find a drive that has a folder titled Images.
@for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do @if exist %%a:\Images\ set IMAGESDRIVE=%%a
@echo The Images folder is on drive: %IMAGESDRIVE%
@dir %IMAGESDRIVE%:\Images /w

Related topics

WinPE for Windows 10

Wpeinit and Startnet.cmd: Using WinPE Startup Scripts

WinPE: Install on a Hard Drive (Flat Boot or Non-RAM)