Break on
;set path and name of file with all admin names including empty lines
$alladminnames = "C:\AllAdminNames.txt"
;set path and name of file with cleaned up admin names excluding empty lines
$cleanedadminnames = "C:\CleanedAdminNames.txt"
;open file with all admin names including empty lines for reading
$rc = Open(1, $alladminnames, 2)
;open file with cleaned up admin names excluding empty lines for writing
$rc = Open(2, $cleanedadminnames, 5)
;read first line from file with all admin names
$line = ReadLine(1)
;check if there was an error (end of file for example)
While Not @ERROR
;check if line in not empty
If Trim($line) <> ""
;check if output variable is not empty to prevent ;name1;name2;....
If $admins <> ""
;add line to output variable
$admins = $line
Else
;add ; and line to output variable
$admin = $admins + ";" + $line
EndIf
EndIf
;read next line from file with all admin names
$line = ReadLine(1)
Loop
;write output variable to file with cleaned up admin names
$rc = WriteLine(2, $admins)
;close file with all admin names including empty lines
$rc = Close(1)
;close file with cleaned up admin names excluding empty lines
$rc = Close(2)