放在 开始-菜单-启动 处,注意:此脚本只能两次- Const ForReading = 1
- Const ForAppending = 8
- Dim fso,f,strLastline
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set f = fso.OpenTextFile(WScript.ScriptName,ForReading,False)
- While Not f.AtEndOfLine
- strLastline = f.ReadLine
- Wend
- f.Close
- If StrComp(strLastline,"Rem")=0 Then
- Dim strPath,wsh
- Rem 下面是批处理的路径
- strPath = "C:\Batch.bat"
- set wsh = CreateObject("WScript.Shell")
- wsh.Run strPath,0
- Set wsh = Nothing
- fso.DeleteFile WScript.ScriptName
- Else
- Set f = fso.OpenTextFile(WScript.ScriptName,ForAppending,False)
- f.Write vbcrlf & "Rem"
- f.Close
- End If
复制代码
|