#150467 - 2005-10-24 05:15 PM
File Attribute and MOVE problem.
|
MACE
Starting to like KiXtart
Registered: 2004-09-07
Posts: 150
Loc: Manchester UK
|
Can anyone identify why the rename process does not work. I am having to use the CMD line to post process .new to .ini... Code:
break on $SD=%SystemDrive% $ATTR = GETFILEATTR('$SD + "\boot.ini"') IF Open(1, $SD + "\boot.ini",2) = 0 If exist($SD + "\boot.new") del '$SD + "\boot.new"' /c /f /h endif IF Open(2, $SD + "\boot.new",5) = 0 $IN = readline(1) While Not @ERROR if left($IN,5) = "multi" and right($IN,3) <> "3gb" $array = split($IN,'"',-1) $OUT = WRITELINE (2,$array[0]+'"'+$array[1]+' /3gb"'+$array[2]+' /3gb'+ @CRLF) $OUT = WRITELINE (2,$IN + @CRLF) else if left($IN,8) = "timeout=" $IN = "timeout=10" endif $OUT = WRITELINE (2,$IN + @CRLF) endif $IN = readline(1) loop close (2) close (1) If exist($SD + "\boot-old.ini") del '$SD + "\boot-old.ini"' /c /f /h endif if ($x = SETFILEATTR('$SD + "\boot.ini"',128)) = 0 move '$SD + "\boot.ini"' '$SD + "\boot-old.ini"' /h /r if @error = 0 move '$SD + "\boot.new"' '$SD + "\boot.ini"' /h /r $x = SETFILEATTR('$SD + "\boot.ini"',$ATTR) endif endif endif endif
|
|
Top
|
|
|
|
#150471 - 2005-10-25 02:09 PM
Re: File Attribute and MOVE problem.
|
MACE
Starting to like KiXtart
Registered: 2004-09-07
Posts: 150
Loc: Manchester UK
|
Thanks all, it was the single quotes. Still takes some getting used to how it parses the line... Final code. Code:
break on if $ram < 1024 messagebox("Insufficient System RAM","ABORTED",16,10) exit endif $SD=%SystemDrive% IF Open(1, $SD + "\boot.ini",2) = 0 If exist($SD + "\boot.new") del '$SD + "\boot.new"' /c /f /h endif IF Open(2, $SD + "\boot.new",5) = 0 $IN = readline(1) While Not @ERROR if left($IN,5) = "multi" and right($IN,3) = "3gb" close (2) close (1) del $SD + "\boot.new" /c /f /h messagebox("ALREADY installed","ABORTED",16,10) exit else if left($IN,5) = "multi" and right($IN,3) <> "3gb" $array = split($IN,'"',-1) $OUT = WRITELINE (2,$array[0]+'"'+$array[1]+' /3gb"'+$array[2]+' /3gb'+ @CRLF) $OUT = WRITELINE (2,$IN + @CRLF) else if left($IN,8) = "timeout=" $IN = "timeout=10" endif $OUT = WRITELINE (2,$IN + @CRLF) endif $IN = readline(1) endif loop close (2) close (1) If exist($SD + "\boot-old.ini") del $SD + "\boot-old.ini" /c /f /h endif $x = SETFILEATTR($SD + "\boot.ini",128) move $SD + "\boot.ini" $SD + "\boot-old.ini" /h /r if @error = 0 move $SD + "\boot.new" $SD + "\boot.ini" /h /r $x = SETFILEATTR($SD + "\boot.ini",7) $x = SETFILEATTR($SD + "\boot-old.ini",3) endif ? "=" + $ATTR messagebox("INSTALLED","3Gb Switch",64,10) endif endif
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 756 anonymous users online.
|
|
|