VB.Net read file content -
i'm trying make simple program message box executable runs in "autorun.inf"
example:
[autorun] open=setup.exe icon=setup.exe,0
how define line says if it's not second line, 5th, mean after text..
open=setup.exe
and trim file name , it's extension?
dim filepath string = "e:\run.inf" dim inf string = my.computer.filesystem.readalltext(filepath) inf = inf.tolower dim startindex integer = inf.indexof("open=") + 5 dim endindex integer = inf.indexof(vbcrlf, startindex) dim executablename string = "" if startindex = 4 msgbox("the executable file name not found @ file :" & vbcrlf & filepath) else if endindex = -1 executablename = inf.substring(startindex) else executablename = inf.substring(startindex, endindex - startindex) end if msgbox("the executable name " & chr(34) & executablename & chr(34)) end if
first read text of inf file , change case lower can search through lower "open="
. , define start index , end index of executable name start after string "open="
, end before newline vbcrlf
. , executable name , show in msgbox
.
Comments
Post a Comment