Maybe I didn't make myself clear...
Maybe you slept through DOS101...

THe syntax for the DOS REN command is as follows:
quote:
C:\>ren /?
Renames a file or files.

RENAME [drive:][path]filename1 filename2.
REN [drive:][path]filename1 filename2.

Note that you cannot specify a new drive or path for your destination file.

C:\>

So then...
$string = "%comspec% /c ren $LMH$num $LMH"

should be...
$string = "%comspec% /c ren $LMH$num lmhosts"
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.