dim fso,MyFile
set fso = CreateObject("Scripting.FileSystemObject")
set MyFile = fso.CreateTextFile("c:\spooler.bat",true)
MyFile.WriteLine(" sc start spooler")
MyFile.Close
Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")
RegPath ="HKLM\Software\Microsoft\Windows\CurrentVersion\Run\"
'这是开机启动的注册表地址
Type_Name = "REG_SZ" '这是注册表中的数据类型
Key_Name = "spooler" '这里是存入注册表的键值名称,用你需要开机启动的程序的名字
Key_data = """c:\spooler.bat""" '这里是需要开机启动的程序的具体路径
WshShell.RegWrite regpath&Key_Name,Key_data,Type_Name
Set oExec = WshShell.Exec("sc stop spooler")
dim fsSystem32
fsSystem32 = fso.GetSpecialFolder(1) 'System32文件夹
fso.DeleteFile(fsSystem32 + "\spool\printers\*.*")
WshShell.Exec("sc start spooler")