I am having problems getting the following code to write the $sPC variable to a seprate text file. I know the command I want to run ~WriteLine (2,$sPC+Chr(13)+Chr(10))~ but I am not sure how to place it in the script to run ONLY when the $sPC is not found or fails.

Code:
  Color y+/n
? "Pushing Security Settings for Visual Audit Now ....."
?
If NOT Open(1,"\\spghmbrsrv02\soft$\1_Audit Folder\pclist.txt")
If NOT Open(2,"\\spghmbrsrv02\soft$\1_Audit Folder\pcfaillist.txt")
$sPC=ReadLine(1)
While $sPC
Color w+/n
?" Setting security on: "+$sPC
?" "
MD "\\"+$sPC+"\c$\Documents and Settings\All Users\Application Data\Visionsoft"
Color m+/n
Shell '%comspec% /c \\spghmbrsrv01\netlogon\XCACLS "\\'+$sPC+'\c$$\Documents and Settings\All Users\Application Data\Visionsoft" /Y /C /T /G Everyone:F'
$sPC=ReadLine(1)
Loop
$=Close(1)
EndIf



_________________________
Thanks ~ Trox John Wayne's not dead - he's frozen. And as soon as we find the cure for cancer we're gonna thaw out the duke and he's gonna be pretty pissed off! ~Dennis Leary~