Sign in to follow this  
Followers 0
Djinsanity

USB drive letter assignment in Winpe

4 posts in this topic

I have created a menu which will run in winpe from a USB device, to apply both imagex and Ghost images which are stored on the same device. The problem is the drive letter changes on different machines. I need to either force the usb to have a set letter or discover the drive letter and assign it to the path of the image. can anybody enlighten me on how this can be achieved? I have spent most of the day trying to find a solution.

Share this post


Link to post
Share on other sites



Djinsanity,

Welcome to the AutoIt forum. :)

Perhaps you could use DriveGetDrive to list the removable drives and then look in each one for a unique file or set of files - perhaps using an MD5 hash (Crypt.au3 could help here). :)

Or you could check for the correct USB deviceID- I showed how to do that here. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Djinsanity,

Without looking at your script I can only assume that you are trying to launch a GUI you created with AutoIT, and just need your WINPE install to call your executable. If this is correct try this out http://4sysops.com/archives/create-a-bootable-windows-pe-3-0-usb-drive-with-rescue-tools-part-2/

Will show you have to get startnet.cmd as part of your WINPE in the system32 folder. If you already have this then just edit the bat be as follows:

wpeinit

YourScript.exe

As long as your script is in the system32 folder there is no need to call f:yourscript.exe

Not sure if I am barking up the right tree but it sounds like a WINPE route that would be best not autoit.

If you got all that hashed out and you are just having a problem calling your wim or gho files then use the @ScriptDir&"yourimage.wim"

Hope that makes sense.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

$a = DriveGetDrive('ALL')
$m = 'W:'
If FileExists($m) Then
    MsgBox(0, 'Message', 'Drive ' & $m & ' already exists')
    Exit
EndIf
For $i = 1 To $a[0]
    If FileExists($a[$i] & '\Label') Then
        Run('subst.exe ' & $m & ' ' & $a[$i] & '\', @SystemDir , @SW_HIDE)
        ExitLoop
    EndIf
Next
If $i > $a[0] Then MsgBox(0, 'Message', 'Label not found')

Edited by AZJIO

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0