找回密码
 加入
搜索
查看: 2394|回复: 5

[系统综合] 如何用au3修改boot.ini文件,新建最后一行并写入数据

[复制链接]
发表于 2012-2-8 00:39:07 | 显示全部楼层 |阅读模式
如何用au3修改boot.ini文件,新建最后一行并写入数据
C:\grldr="PE tools"   

如何啊!!谢谢各位大哥帮帮忙了啊
发表于 2012-2-8 00:42:29 | 显示全部楼层
参考filewriteline
boot.ini属于INI文件,也以参考iniwrite
发表于 2012-2-8 00:43:29 | 显示全部楼层
看看帮助里的IniWrite
发表于 2012-2-8 00:55:19 | 显示全部楼层
这个文件是只读属性, 写之前必须用 FileSetAttrib 去掉只读
 楼主| 发表于 2012-2-8 10:45:08 | 显示全部楼层
$file = @HomeDrive & '\boot.ini'
MsgBox(0,0,@HomeDrive)
If StringInStr(FileRead($file), 'abc.abc') Then MsgBox(0,0,'found the string')
FileSetAttrib($file, '-RSH')
$str = StringRegExpReplace(FileRead($file), 'timeout\s*=\s*\d+', 'timeout=5')
$tmp_file = FileOpen($file, 2)
FileWrite($file, $str)
FileClose($tmp_file)
FileSetAttrib($file, '+RSH')
ShellExecute($file)
 楼主| 发表于 2012-2-8 10:46:19 | 显示全部楼层
FileSetAttrib("C:\boot.ini", "-RSH")
                IniWrite("C:\boot.ini", "boot loader", "timeout", "4" )
                IniWrite("C:\boot.ini", "operating systems", "c:\grldr", '"' & "boot grub" & '"')
                FileSetAttrib( "C:\boot.INI", "+RSH")
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-20 19:24 , Processed in 0.081502 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表