Hey guys, I'm a bit of a nub with WinPE. I have in the past created a bootable PE environment which booted over PXE, and had it launch a batch file which allowed you to run different tools from a network share.
What I want to do is boot a WinPE environment from a flash drive, which launches a batch file stored on the flash drive's root directory, so I can launch applications directly from the flash drive's subdirectories, rather than having to rely on a network share. This would be particularly useful in the field, where I don't have access to the network share.
I've been having trouble finding any insight on automatically detecting which drive is the flash drive and launching a script from it. I can only ever find stuff on launching applications which are baked into the WIM itself.
Any insight would be greatly appreciated! Thanks!
I do this with things like OpenOffice to keep the WIM size down - have a script autodetect the drive, then launch another script from that drive to start OpenOffice. This is how I do it, you could try something like this launched from startnet.cmd:
- Just change the pathing variable to the path to the script on your drive.
@echo off
set found=0
:start
for %%a in (A B C D E F G H I J K L M N O P Q R S T U V W Y Z) do (
if exist %%a:\OpenOfficePortable\OpenOfficePortable.exe (
set found=1
set foundloc=%%a
))
if "%found%"=="1" (
goto skip
)
if "%found%"=="0" (
echo Msgbox "ERROR: Could not locate the stick containing \OpenOfficePortable\OpenOfficePortable.exe. Please plug it back in and then run this script again.", vbSystemModal + vbCritical, "OpenOffice Launcher" > %~dp0openoffice2.vbs
start %~dp0openoffice2.vbs
exit
)
exit
:skip
echo.
echo CreateObject("WScript.Shell").Popup "Launching OpenOffice from USB, please wait...", 7, "OpenOffice Launcher", 64 >%~dp0openoffice2.vbs
start %~dp0openoffice2.vbs
start %foundloc%:\OpenOfficePortable\OpenOfficePortable.exe
exit
Do note that there is probably a more efficient way of doing this code-wise, but this has always worked reliably for me.
Edited by spleenharvester, 03 August 2016 - 11:23 PM.