penggilas2 Posted June 12, 2012 Share Posted June 12, 2012 (edited) Read ini File. : drive.ini [partition1] Driveletter=C: Label=Windows Xp [partition2] Driveletter=D: Label=Windows 7 [partition3] Driveletter=E: Label=Dokument [partition4] Driveletter=F: Label=Recovery Local $var = IniReadSectionNames("drive.ini") If @error Then MsgBox(4096, "", "Error occurred, probably no INI file.") Else For $i = 1 To $var[0] $MSG = IniRead("drive.ini", $var[$i], "LABEL", "NotFound") MsgBox(4096, "", $MSG) Next EndIf I want searcrh What is the section name of Windows Xp, Windows 7, Dokument,.. Thank's for All.. What is the script If i type windows xp .... will show partition1 Edited June 12, 2012 by penggilas2 Link to comment Share on other sites More sharing options...
Malkey Posted June 12, 2012 Share Posted June 12, 2012 Try these methods. Local $sTypedInLabel = "windows xp" Local $sSectName Local $var = IniReadSectionNames("drive.ini") If @error Then MsgBox(4096, "", "Error occurred, probably no INI file.") Else For $i = 1 To $var[0] If IniRead("drive.ini", $var[$i], "LABEL", "NotFound") = $sTypedInLabel Then $sSectName = $var[$i] ExitLoop EndIf Next MsgBox(0, "Find Section Name", $sTypedInLabel & ' from section name "' & $sSectName & '"') EndIf ;Or Local $sFile = FileRead("drive.ini") If StringInStr($sFile, "Label=" & $sTypedInLabel) <> 0 Then _ ConsoleWrite(StringRegExpReplace($sFile, "(?is).*\[(.*?)\].*?Label=" & $sTypedInLabel & ".*", "$1") & @LF) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now