Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Shell.Application")
Set objSysInfo = CreateObject("WScript.Shell")
Sub Main()
Set objScriptExec = objShell.CreateShortcut(objFSO.GetAbsolutePathName("C:\Users\Public\Desktop\test.lnk"))
objScriptExec.TargetPath = "C:\Windows\System32\notepad.exe"
objScriptExec.Save
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Visible = True
objIE.Navigate("http://www.example.com")
End Sub
Set objFSO = CreateObject("Scripting.FileSystemObject")
创建一个
FileSystemObject
对象。该对象提供了对文件系统操作的属性和方法,通过这个对象,你可以读取、写入、删除、移动文件等。
Set objShell = CreateObject("Shell.Application")
创建一个Shell对象。它提供了与Windows shell交互的方法,例如创建快捷方式、启动应用程序等。
Set objSysInfo = CreateObject("WScript.Shell")
创建一个WScript.Shell对象。它提供了访问系统环境变量和执行系统命令的方法。
Sub Main()
这行代码定义了一个名为Main的子程序。
Set objScriptExec = objShell.CreateShortcut(objFSO.GetAbsolutePathName("C:\Users\Public\Desktop\test.lnk"))
使用FileSystemObject的GetAbsolutePathName方法取"C:\Users\Public\Desktop\test.lnk"这个文件的绝对路径。
使用Shell对象的CreateShortcut方法创建一个快捷方式。该快捷方式的路径就是上一步获取的绝对路径。这个快捷方式被赋值给objScriptExec变量。
objScriptExec.TargetPath = "C:\Windows\System32\notepad.exe"
这行代码设置objScriptExec(即我们之前创建的快捷方式)的目标路径为"C:\Windows\System32\notepad.exe",也就是说,这个快捷方式会指向记事本应用程序。
objScriptExec.Save
这行代码保存我们创建的快捷方式。如果之前的步骤都正确,那么在用户桌面上就会有一个名为"test.lnk"的快捷方式,该快捷方式会打开记事本应用程序。
Set objIE = CreateObject("InternetExplorer.Application")
创建一个Internet Explorer浏览器对象。
Set objIE = CreateObject("InternetExplorer.Application")
创建一个Internet Explorer浏览器对象。
objIE.Visible = True
将这个浏览器对象设置为可见。这意味着它会打开一个真实的IE窗口。
objIE.Navigate("http://www.example.com")
导航到"http://www.example.com"这个网址。
End Sub 表示Main子程序的结束。
免责声明:本文章仅供了解脚本病毒代码,请勿将其用于非法用途。