Sign in to follow this  
Followers 0
redfive19

OemPnPDriversPath Enumeration

1 post in this topic

This forum has given so much to me so I wanted to give back....I wrote this script to enumerate a folder structure and make it ready for a sysprep.inf. It's pretty simple and makes use of FileListToArray3.au3 (which I got from this forum, can't remember the author - SORRY!!) Hope this helps someone!!

#Include <File.au3>
#include <FileListToArray3.au3>
#include <array.au3>


$folder = FileSelectFolder ( "Choose the DRV folder", '', 1)
If @error = 1 Then
    Exit
EndIf

If MsgBox(64+4, 'New .INF file', 'Create a new .INF file?') = 6 Then
    $sysprepfile = FileSaveDialog('Save .INF file', '', ".INF files (*.inf)", 2)
Else
    MsgBox(0, 'DISCLAIMER', 'THIS APP WILL WRITE THE RECURSIVE DIRECTORY STRUCTURE OF A TOP FOLDER TO SYSPREP.INF'  & @CRLF & _
                        'PLEASE MAKE SURE YOU HAVE BACKED UP YOUR SYSPREP.INF BEFORE RUNNING THIS TOOL!!!')
    $sysprepfile = FileOpenDialog('Choose .INF file', '', ".INF files (*.inf)")
EndIf


If @error = 1 Then
    Exit
EndIf
If StringRight($sysprepfile, 4) <> '.inf' Then
    $sysprepfile = $sysprepfile & '.inf'
EndIf

$drvstringarray = StringSplit($folder, '\')
$x = $drvstringarray[0]
$topfolder = $drvstringarray[$x]

$drvarray = _FileListToArray3($folder, "*", 2, 1, 0, '')
$drvfolder = '\' & $topfolder & '\' & $drvarray[1] & ';'
For $a = 2 to $drvarray[0]
    $drvfolder = $drvfolder & '\' & $topfolder & '\' & $drvarray[$a] & ';'
Next
$drvfolder = StringTrimRight($drvfolder, 1)
IniWrite($sysprepfile, 'Unattended', 'OemPnPDriversPath', '"' & $drvfolder & '"')

FileListToArray3.au3

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