OK, now we're getting somewhere...

Took off comment from:
$file = "%systemdrive%\emran.txt"

Took off extra " from:
?"Unable to create $file ! - [" + @error + "] : " + @serror

Ran OK!
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.