2013-02-07 19:25:01 +00:00
|
|
|
Dim filesys, srcfile, srcfilename, fline, dstfilename, dstfile, myshell, netuse
|
2013-12-03 07:34:05 +00:00
|
|
|
Dim tmpstr, elems, instdrv, instpart, partcfg, partbios, partuefi
|
2013-02-07 19:25:01 +00:00
|
|
|
Set myshell = WScript.createObject("WScript.Shell")
|
|
|
|
Set netuse = myshell.Exec("net use")
|
|
|
|
Dim drvletter
|
|
|
|
Do While Not netuse.StdOut.AtEndOfStream
|
|
|
|
tmpstr = netuse.StdOut.ReadLine()
|
|
|
|
if InStr(tmpstr,"install") > 0 Then
|
|
|
|
Do while InStr(tmpstr," ") > 0
|
|
|
|
tmpstr = Replace(tmpstr," "," ")
|
|
|
|
Loop
|
|
|
|
elems = Split(tmpstr)
|
|
|
|
drvletter=elems(1)
|
|
|
|
End If
|
|
|
|
Loop
|
2013-05-16 21:03:24 +00:00
|
|
|
instdrv = myshell.ExpandEnvironmentStrings ( "%INSTALLTO%" )
|
|
|
|
if InStr(instdrv,"%INSTALLTO%") Then
|
2013-05-20 14:56:01 +00:00
|
|
|
Set myenv=myshell.Environment("User")
|
2013-05-17 13:38:45 +00:00
|
|
|
instdrv = myenv("INSTALLTO")
|
|
|
|
End If
|
|
|
|
if instdrv = "" Then
|
2013-05-20 14:56:01 +00:00
|
|
|
Set myenv=myshell.Environment("System")
|
2013-05-17 13:38:45 +00:00
|
|
|
instdrv = myenv("INSTALLTO")
|
|
|
|
End If
|
|
|
|
if instdrv = "" Then
|
2013-12-03 07:34:05 +00:00
|
|
|
instdrv = "0:0"
|
2013-05-16 21:03:24 +00:00
|
|
|
End If
|
2013-12-03 07:34:05 +00:00
|
|
|
|
|
|
|
Dim strpoint
|
|
|
|
strpoint = InStr(instdrv, ":")
|
|
|
|
if strpoint Then
|
|
|
|
tmpstr = instdrv
|
|
|
|
instdrv = left(tmpstr,strpoint-1)
|
|
|
|
instpart = mid(tmpstr,strpoint+1)
|
|
|
|
End If
|
|
|
|
|
|
|
|
partcfg = myshell.ExpandEnvironmentStrings ( "%PARTCFG%" )
|
|
|
|
if InStr(partcfg,"%PARTCFG%") Then
|
|
|
|
Set myenv=myshell.Environment("User")
|
|
|
|
partcfg = myenv("%PARTCFG%")
|
|
|
|
End If
|
|
|
|
if instdrv = "" Then
|
|
|
|
Set myenv=myshell.Environment("System")
|
|
|
|
partcfg = myenv("%PARTCFG%")
|
|
|
|
End If
|
|
|
|
|
|
|
|
strpoint = InStr(partcfg, "[BIOS]")
|
|
|
|
If strpoint Then
|
|
|
|
partbios = Mid(partcfg, strpoint+6)
|
|
|
|
strpoint = InStr(partbios, "[UEFI]")
|
|
|
|
If strpoint Then
|
|
|
|
partuefi = Mid(partbios, strpoint+6)
|
|
|
|
partbios = Left(partbios, strpoint-1)
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
|
2013-02-07 19:25:01 +00:00
|
|
|
Set filesys = CreateObject("Scripting.FileSystemObject")
|
|
|
|
dim notefi
|
|
|
|
notefi=1
|
|
|
|
if filesys.FileExists(drvletter&"\utils\windows\detectefi.exe") then
|
|
|
|
notefi = myshell.run(drvletter&"\utils\windows\detectefi.exe",1,true)
|
|
|
|
end if
|
|
|
|
srcfilename = WScript.Arguments.Item(0)
|
|
|
|
dstfilename = WScript.Arguments.Item(1)
|
|
|
|
Set srcfile = filesys.OpenTextFile(srcfilename,1)
|
|
|
|
Set dstfile = filesys.OpenTextFile(dstfilename,2,True)
|
|
|
|
dim partitionscheme
|
|
|
|
Do Until srcfile.AtEndOfStream
|
|
|
|
fline = srcfile.ReadLine
|
|
|
|
if notefi=0 then
|
|
|
|
fline = Replace(fline,"==BOOTPARTITIONS==","<CreatePartitions><CreatePartition><Order>1</Order><Type>EFI</Type><Size>260</Size></CreatePartition><CreatePartition><Order>2</Order><Type>MSR</Type><Size>128</Size></CreatePartition><CreatePartition><Order>3</Order><Type>Primary</Type><Extend>true</Extend></CreatePartition></CreatePartitions>")
|
2013-12-03 07:34:05 +00:00
|
|
|
|
|
|
|
if partuefi<>"" Then
|
|
|
|
fline = Replace(fline,"==DISKCONFIG==", partuefi)
|
|
|
|
else
|
2013-12-10 10:34:09 +00:00
|
|
|
fline = Replace(fline,"==DISKCONFIG==","<Disk><DiskID>" & instdrv & "</DiskID><WillWipeDisk>true</WillWipeDisk><CreatePartitions><CreatePartition><Order>1</Order><Type>EFI</Type><Size>260</Size></CreatePartition><CreatePartition><Order>2</Order><Type>MSR</Type><Size>128</Size></CreatePartition><CreatePartition><Order>3</Order><Type>Primary</Type><Extend>true</Extend></CreatePartition></CreatePartitions></Disk>")
|
2013-12-03 07:34:05 +00:00
|
|
|
end if
|
|
|
|
|
|
|
|
if instpart<>"0" Then
|
|
|
|
fline = Replace(fline,"==INSTALLTOPART==", instpart)
|
|
|
|
else
|
|
|
|
fline = Replace(fline,"==INSTALLTOPART==","3")
|
|
|
|
end if
|
2013-02-07 19:25:01 +00:00
|
|
|
else
|
|
|
|
fline = Replace(fline,"==BOOTPARTITIONS==","<CreatePartitions><CreatePartition><Order>1</Order><Type>Primary</Type><Extend>true</Extend></CreatePartition></CreatePartitions>")
|
2013-12-03 07:34:05 +00:00
|
|
|
|
|
|
|
if partbios<>"" Then
|
|
|
|
fline = Replace(fline,"==DISKCONFIG==", partbios)
|
|
|
|
else
|
2013-12-10 10:34:09 +00:00
|
|
|
fline = Replace(fline,"==DISKCONFIG==", "<Disk><DiskID>" & instdrv & "</DiskID><WillWipeDisk>true</WillWipeDisk><CreatePartitions><CreatePartition><Order>1</Order><Type>Primary</Type><Extend>true</Extend></CreatePartition></CreatePartitions></Disk>")
|
2013-12-03 07:34:05 +00:00
|
|
|
end if
|
|
|
|
|
|
|
|
if instpart<>"0" Then
|
|
|
|
fline = Replace(fline,"==INSTALLTOPART==",instpart)
|
|
|
|
else
|
|
|
|
fline = Replace(fline,"==INSTALLTOPART==","1")
|
|
|
|
end if
|
2013-02-07 19:25:01 +00:00
|
|
|
end if
|
2013-12-03 07:34:05 +00:00
|
|
|
|
2013-05-16 21:03:24 +00:00
|
|
|
fline = Replace(fline,"==INSTALLTODISK==",instdrv)
|
2013-12-03 07:34:05 +00:00
|
|
|
|
|
|
|
dstfile.WriteLine(Replace(fline,"==INSTALLSHARE==",drvletter))
|
2013-02-07 19:25:01 +00:00
|
|
|
Loop
|