第一种:在开始菜单的启动里加载;
' Date:2007-07-27 By:Snowhill
set args=WScript.Arguments
if args.Count=0 then
MsgBox "Please drag vbs script file on my icon" & "I'm place int into the Startup group"
WScript.Quit
end if
set fs=CreateObject("Scripting.FileSystemObject")
set wshshell=CreateObject("WScript.Shell")
scriptfile=args(0)
'获取扩展文件名
if not lcase(fs.GetExtensionName(scriptfile))="vbs"then
MsgBox "I only accept vbs script files!"
WScript.Quit
end if
startup =wshshell.SpecialFolders("Startup")
name=InputBox("Under which name should I place the scripte" & """"_
& fs.GetBaseName(scriptfile)&"""into the startup"_
&"group?","autostrat script")
set scut=wshshell.CreateShortcut(startup&"\"&name&".lnk")
scut.TargetPath=scriptfile
scut.Save
MsgBox "Script has been successfully linked to your startup group!"
第二种:在注册表里添加;
'date:2007-07-27 by:snowhill
set args=WScript.Arguments
if args.Count=0 then
MsgBox "Please drag a vbs script file on my icon"_
& "I'm place it into the startup group!"
WScript.Quit
end if
set fs=CreateObject("Scripting.FileSystemObject")
set wshshell=CreateObject("WScript.Shell")
scriptfile=args(0)
if not lcase(fs.GetExtensionName(scriptfile))="vbs" then
MsgBox "I only accept vbs script files!"
WScript.Quit
end if
key="HKLM\Software\Microsoft\Windows\CurrentVersion\Run\"
' use this key on windows NT/2K
'key="HKLM\Software\microsoft\windows NT\CurrentVersion\Run\"
'写入当前用户的注册表值
'key="HKU\Software\microsoft\windows\CurrentVersion\Run\"
wshshell.RegWrite key&"myscript",scriptfile
MsgBox "Script has been success fully added to the Run key!"
注:在HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\下的userinit好像也可以加载;
在HKCU\software\microsoft\windows nt\CurrentVersion\windows\下的Load也可以载;
第三种:在组策略里设置:
本地计算机策略->WINDOWS设置->脚本(启动/关机),这个具体是怎么实现的是个?反正可以加载,至于怎么用用命令行或程序实现就是个??实际上他是改动了以下文件:
C:\WINDOWS\System32\GroupPolicy\Machine\Scripts这里面有一个scripts.ini文件,其编写格式如下:
0CmdLine=D:\run.vbs
0Parameters=
1CmdLine=D:\run1.vbs
1Parameters=
2CmdLine=D:\run2.vbs
2Parameters=
直接改就可以实现了.
另外像改AUTOEXEC.BAT这种就不提了.