D dragon8838 Unregistered / Unconfirmed GUEST, unregistred user! 2001-04-17 #1 <font color=#ff0000 size=5>请教如何实现修改autoexec.bat文件和config.sys文件!!!请写详细代码!!!谢谢</font> (100分)<br />请教如何实现修改autoexec.bat文件,请写出详细代码,谢谢!!!(我是新新新手,尽量写的详细点,好吗)
<font color=#ff0000 size=5>请教如何实现修改autoexec.bat文件和config.sys文件!!!请写详细代码!!!谢谢</font> (100分)<br />请教如何实现修改autoexec.bat文件,请写出详细代码,谢谢!!!(我是新新新手,尽量写的详细点,好吗)
Q qdshen Unregistered / Unconfirmed GUEST, unregistred user! 2001-04-17 #2 assignfile(f,'c:/Autoexec.txt'); Rewrite(f); Writeln(f,'@echo off'); Writeln(f,'@path='+GetWinDir); Writeln(f,'@path='+GetWinDir+'Command'); Writeln(f,'@set path='+GetWinDir); Writeln(f,'@set path='+GetWinDir+'Command'); closefile(f);
assignfile(f,'c:/Autoexec.txt'); Rewrite(f); Writeln(f,'@echo off'); Writeln(f,'@path='+GetWinDir); Writeln(f,'@path='+GetWinDir+'Command'); Writeln(f,'@set path='+GetWinDir); Writeln(f,'@set path='+GetWinDir+'Command'); closefile(f);
一 一天到晚游泳的瑜 Unregistered / Unconfirmed GUEST, unregistred user! 2001-04-17 #3 你直接右键点击autoexec.bat文件,然后选择“编辑”,在那里修改你的内容就可以了, 但要重启机子,这样修改的内容才可以生效。
W wjiachun Unregistered / Unconfirmed GUEST, unregistred user! 2001-04-17 #7 dragon8838: 定义 var f:textfile;
D dragon8838 Unregistered / Unconfirmed GUEST, unregistred user! 2001-04-17 #8 下面这段程序好象改不了aotoexec.bat文件啊,请问问题出在那里? var f:textfile; begin assignfile(f,'c:/Autoexec.txt'); Rewrite(f); Writeln(f,'@echo off'); closefile(f); end;
下面这段程序好象改不了aotoexec.bat文件啊,请问问题出在那里? var f:textfile; begin assignfile(f,'c:/Autoexec.txt'); Rewrite(f); Writeln(f,'@echo off'); closefile(f); end;
萧 萧月禾 Unregistered / Unconfirmed GUEST, unregistred user! 2001-04-17 #9 Rewrite是创建并打开一个新文件 Reset是打开一个存在的文件
T tatami Unregistered / Unconfirmed GUEST, unregistred user! 2001-04-17 #10 var f:textfile; begin assignfile(f,'c:/Autoexec.txt'); /// ^^^是不是应该为bat,程序本身没错的呀 Rewrite(f); Writeln(f,'@echo off'); closefile(f); end;
var f:textfile; begin assignfile(f,'c:/Autoexec.txt'); /// ^^^是不是应该为bat,程序本身没错的呀 Rewrite(f); Writeln(f,'@echo off'); closefile(f); end;
W wjiachun Unregistered / Unconfirmed GUEST, unregistred user! 2001-04-17 #11 dragon8838: 注意你要编辑的是aotoexec.bat文件而不是Autoexec.txt文件
D dragon8838 Unregistered / Unconfirmed GUEST, unregistred user! 2001-04-17 #12 to 萧月禾 Rewrite 可以创建并打开一个新文件 我用Reset 好象不行,有错误! ------------可以运行------------ var f:textfile; begin assignfile(f,'c:/Autoexec.bat'); Rewrite(f); Writeln(f,'@echo off'); closefile(f); end; ------------不可以运行------------ var f:textfile; begin assignfile(f,'c:/Autoexec.bat'); Reset(f); Writeln(f,'@echo off'); closefile(f); end;
to 萧月禾 Rewrite 可以创建并打开一个新文件 我用Reset 好象不行,有错误! ------------可以运行------------ var f:textfile; begin assignfile(f,'c:/Autoexec.bat'); Rewrite(f); Writeln(f,'@echo off'); closefile(f); end; ------------不可以运行------------ var f:textfile; begin assignfile(f,'c:/Autoexec.bat'); Reset(f); Writeln(f,'@echo off'); closefile(f); end;
D dragon8838 Unregistered / Unconfirmed GUEST, unregistred user! 2001-04-17 #13 我需要的是修改autoexec.bat文件,不是新建一个autoexec.bat文件!
C crystal Unregistered / Unconfirmed GUEST, unregistred user! 2001-04-17 #15 你不好用TStringList读入后再根据每个Item的值做出修改再保存吗?
C crystal Unregistered / Unconfirmed GUEST, unregistred user! 2001-04-17 #17 var Autoexec : TStringList TempStr : string; begin Autoexec:=TStringList.Create with Autoexecdo begin try Items.LoadFromFile('C:/Autoexec.bat'); TempStr := Items[0]; if TempStr = 'XXX' then XXX... else if TempStr = 'XXX' then XXX... TempStr := 'XXX'; Items[0] := TempStr; Items.SaveToFile('C:/Autoexec.bat'); finally Free; end; end; 根据需要改吧
var Autoexec : TStringList TempStr : string; begin Autoexec:=TStringList.Create with Autoexecdo begin try Items.LoadFromFile('C:/Autoexec.bat'); TempStr := Items[0]; if TempStr = 'XXX' then XXX... else if TempStr = 'XXX' then XXX... TempStr := 'XXX'; Items[0] := TempStr; Items.SaveToFile('C:/Autoexec.bat'); finally Free; end; end; 根据需要改吧
C crystal Unregistered / Unconfirmed GUEST, unregistred user! 2001-04-17 #19 是啊...你查一下帮助嘛,好像是有一个例子的,帮助的TStringList下面