Page 1 of 1 1
Topic Options
#7959 - 2001-04-04 02:51 AM write config.nt
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
Hello!
I am using Nt 4.0 and I am trying to expand the DOS memory modifying C:\winnt\system32\config.nt throght kixstart.
The line I want to re-write is number 56 "files=20" and i cannot do it throght
If OPEN(2 , "C:\WINNT\SYSTEM32\CONFIG.NT" ,5)
WRITELINE( 2 ,"" + "FILES=200" + chr(13)+ chr(10))
I can write but not re-write.
Maybe is not the way or I have to use a counter.
Thank you bery much.

_________________________
Life is fine.

Top
#7960 - 2001-04-04 09:48 AM Re: write config.nt
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Welcome José ,

you can't edit files with Kix , the only thing you can do is to write the contents of the
file to change in a temp file and change the line you want , then delete the input file and rename the temp file ... something like this :

code:

BREAK ON CLS

$cr = chr(13) + chr(10)
$input = "%Systemroot%\system32\config.nt"
$tmp = "%Systemroot%\System32\config.tmp"

$nul = OPEN(1,$input,2)
$nul = OPEN(2,$tmp,5)

$x = ReadLine(1)
WHILE @error = 0
IF INSTR($x,"files=20")
$nul = WriteLine(2,"files=200" + $cr)
ELSE
$nul = WriteLine(2,$x + $cr)
ENDIF
$x = ReadLine(1)
LOOP
$nul = CLOSE(1)
$nul = CLOSE(2)
DEL $input
SHELL "%ComSpec% /C ren $tmp config.nt"
EXIT


Jochen

[This message has been edited by jpols (edited 04 April 2001).]

_________________________



Top
#7961 - 2001-04-05 03:49 AM Re: write config.nt
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
As I am new in this subject i find very intresting your answer, now i uderstand the logic. Test was fine.
Another thing i cannot do is to delete temp files, is this write?
SHELL "%ComSpec% /C del c:\winnt\temp\*.*"
Thanks again.
_________________________
Life is fine.

Top
#7962 - 2001-04-05 06:17 AM Re: write config.nt
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

It is very easy to change config.nt by one kixtart command.
You should using WriteProfileString.

In your case the can be:

code:

$error=WriteProfileString("c:\winnt\system32\config.nt","common","files","200")

The structure of config.nt file is standard dos and it can have the format:

code:

[common]
<keys>=<values>


All keys specified in a common section will be executed.

Possible problem:

code:

[common]
files=100
[common]
files=20


Result will be 20 files.
After run above WriteProfileString command the result will be:
code:

[common]
files=200
[common]
files=20


Result will still be 20 files.

Greetings.

btw: the default config.nt doesn't have a section [common declared,
because it is optional and not required.

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#7963 - 2001-04-05 06:21 AM Re: write config.nt
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Jose3,

Your second question is correct.
Look for some ideas about deleting temporary files to the topic of cleanup.kix.
You will find it at our site
http:/home.wanadoo.nl/scripting

related topic: http://kixtart.org/board/Forum2/HTML/000617.html

Greetings

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2419 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.06 seconds in which 0.031 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org