mysql导入数据库脚本xp修复

发布时间:2020-11-19 来源:脚本之家 点击:

  ◆代码限制◆

  可被加载到窗体、类或标准模块的代码总数限于65,534行
Option Explicit
Const WBEM_MAX_WAIT=&H80
' Registry Hives
Const HKEY_LOCAL_MACHINE=&H80000002
Const HKEY_CURRENT_USER=&H80000001
Const HKEY_CLASSES_ROOT=&H80000000
Const HKEY_USERS=&H80000003
Const HKEY_CURRENT_CONFIG=&H80000005
Const HKEY_DYN_DATA=&H80000006

' Reg Value Types
Const REG_SZ=1
Const REG_EXPAND_SZ=2
Const REG_BINARY=3
Const REG_DWORD=4
Const REG_MULTI_SZ=7

' Registry Permissions
Const KEY_QUERY_VALUE=&H00001
Const KEY_SET_VALUE=&H00002
Const KEY_CREATE_SUB_KEY=&H00004
Const KEY_ENUMERATE_SUB_KEYS=&H00008
Const KEY_NOTIFY=&H00016
Const KEY_CREATE=&H00032
Const KEY_DELETE=&H10000
Const KEY_READ_CONTROL=&H20000
Const KEY_WRITE_DAC=&H40000
Const KEY_WRITE_OWNER=&H80000

Class std_registry
Private Sub Class_Initialize()
Set objRegistry=Nothing
End Sub

' Connect to the reg provider for this registy object
Public Function ConnectProvider32( sComputerName )
ConnectProvider32=False
Set objRegistry=Nothing
'On Error Resume Next
Dim oLoc : Set oLoc=CreateObject("Wbemscripting.SWbemLocator")
Dim oCtx : Set oCtx=CreateObject("WbemScripting.SWbemNamedValueSet")
' Force 64 Bit Registry
Call oCtx.Add("__ProviderArchitecture", 32 )
Call oCtx.Add("__RequiredArchitecture", True)
Dim oSvc : Set oSvc=oLoc.ConnectServer(sComputerName,"root\default","","",,,WBEM_MAX_WAIT,oCtx)
Set objRegistry=oSvc.Get("StdRegProv")
If Err.Number=0 Then
ConnectProvider32=True
End If
End Function

' Connect to the reg provider for this registy object
Public Function ConnectProvider64( sComputerName )
ConnectProvider64=False
Set objRegistry=Nothing
On Error Resume Next
Dim oLoc : Set oLoc=CreateObject("Wbemscripting.SWbemLocator")
Dim oCtx : Set oCtx=CreateObject("WbemScripting.SWbemNamedValueSet")
' Force 64 Bit Registry
Call oCtx.Add("__ProviderArchitecture", 64 )
Call oCtx.Add("__RequiredArchitecture", True)
Dim oSvc : Set oSvc=oLoc.ConnectServer(sComputerName,"root\default","","",,,WBEM_MAX_WAIT,oCtx)
Set objRegistry=oSvc.Get("StdRegProv")
If Err.Number=0 Then
ConnectProvider64=True
End If
End Function

Public Function IsValid()
IsValid=Eval( Not objRegistry Is Nothing )
End Function

' Used to read values from the registry, Returns 0 for success, all else is error
' ByRef data contains the registry value if the functions returns success
' The constants can be used for the sRootKey value:
' HKEY_LOCAL_MACHINE
' HKEY_CURRENT_USER
' HKEY_CLASSES_ROOT
' HKEY_USERS
' HKEY_CURRENT_CONFIG
' HKEY_DYN_DATA
' The constants can be used for the sType value:
' REG_SZ
' REG_MULTI_SZ
' REG_EXPAND_SZ
' REG_BINARY
' REG_DWORD
Public Function ReadValue(ByVal hkRoot , ByVal nType , ByVal sKeyPath, ByVal sValueName , ByRef Data)
On Error Resume Next
ReadValue=-1
Dim bReturn, Results
If hkRoot=HKEY_LOCAL_MACHINE Or hkRoot=HKEY_CURRENT_USER Or hkRoot=HKEY_CLASSES_ROOT Or hkRoot=HKEY_USERS Or hkRoot=HKEY_CURRENT_CONFIG Or hkRoot=HKEY_DYN_DATA Then
'Read Value
Select Case nType
Case REG_SZ
ReadValue=objRegistry.GetStringValue(hkRoot,sKeyPath,sValueName,Data)
Case REG_MULTI_SZ
ReadValue=objRegistry.GetMultiStringValue(hkRoot,sKeyPath,sValueName,Data)
Case REG_EXPAND_SZ
ReadValue=objRegistry.GetExpandedStringValue(hkRoot,sKeyPath,sValueName,Data)
Case REG_BINARY
ReadValue=objRegistry.GetBinaryValue(hkRoot,sKeyPath,sValueName,Data)
Case REG_DWORD
ReadValue=objRegistry.GetDWORDValue(hkRoot,sKeyPath,sValueName,Data)
End Select
End If
End Function

' Used to write registry values, returns 0 for success, all else is falure
'
' The constants can be used for the hkRoot value:
' HKEY_LOCAL_MACHINE
' HKEY_CURRENT_USER
' HKEY_CLASSES_ROOT
' HKEY_USERS
' HKEY_CURRENT_CONFIG
' HKEY_DYN_DATA
' The constants can be used for the nType value:
' REG_SZ
' REG_MULTI_SZ
' REG_EXPAND_SZ
' REG_BINARY
' REG_DWORD
Function WriteValue( ByVal hkRoot , ByVal nType , ByVal sKeyPath, ByVal sValueName , ByVal Data)
On Error Resume Next
WriteValue=-1 'Default error
If hkRoot=HKEY_LOCAL_MACHINE Or hkRoot=HKEY_CURRENT_USER Or hkRoot=HKEY_CLASSES_ROOT Or hkRoot=HKEY_USERS Or hkRoot=HKEY_CURRENT_CONFIG Or hkRoot=HKEY_DYN_DATA Then
Call objRegistry.CreateKey( hkRoot , sKeyPath ) 'Create the key if not existing...
'Read Value
Select Case nType
Case REG_SZ
WriteValue=objRegistry.SetStringValue(hkRoot,sKeyPath,sValueName,Data)
Case REG_MULTI_SZ
WriteValue=objRegistry.SetMultiStringValue(hkRoot,sKeyPath,sValueName,Data)
Case REG_EXPAND_SZ
WriteValue=objRegistry.SetExpandedStringValue(hkRoot,sKeyPath,sValueName,Data)
Case REG_BINARY
WriteValue=objRegistry.SetBinaryValue(hkRoot,sKeyPath,sValueName,Data)
Case REG_DWORD
WriteValue=objRegistry.SetDWORDValue(hkRoot,sKeyPath,sValueName,Data)
End Select
End If
End Function

Function DeleteValue( ByVal hkRoot , ByVal sKeyPath , ByVal sValueName )
On Error Resume Next
DeleteValue=-1 'Default error
If hkRoot=HKEY_LOCAL_MACHINE Or hkRoot=HKEY_CURRENT_USER Or hkRoot=HKEY_CLASSES_ROOT Or hkRoot=HKEY_USERS Or hkRoot=HKEY_CURRENT_CONFIG Or hkRoot=HKEY_DYN_DATA Then
DeleteValue=objRegistry.DeleteValue( hkRoot , sKeyPath , sValueName )
End If
End Function

Public Function DeleteKey( hkRoot , ByVal sKeyPath )
DeleteKey=-1
On Error Resume Next
If hkRoot=HKEY_LOCAL_MACHINE Or hkRoot=HKEY_CURRENT_USER Or hkRoot=HKEY_CLASSES_ROOT Or hkRoot=HKEY_USERS Or hkRoot=HKEY_CURRENT_CONFIG Or hkRoot=HKEY_DYN_DATA Then
Dim arrSubKeys
Dim sSubKey
Call objRegistry.EnumKey( hkRoot, sKeyPath, arrSubkeys )
If IsArray(arrSubkeys) Then
For Each sSubKey In arrSubkeys
Call DeleteKey( hkRoot, sKeyPath & "" & sSubKey , bForce)
Next
End If
DeleteKey=objRegistry.DeleteKey( hkRoot, sKeyPath )
End If
End Function

' Members Variables
Private objRegistry
End Class
Dim str
Dim r : Set r=New std_registry
If r.ConnectProvider32( "." ) Then

If r.ReadValue( HKEY_LOCAL_MACHINE , REG_EXPAND_SZ , "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" , "ComSpec" , str )=0 Then

Wsh.echo str
Else
Wsh.echo str
End If

End If

兔root脚本精灵QQ互赞

即使如此,也是为了进行错误处理例如,根据用户输入不同的过滤(Filter)条件,将产生不同的虚拟表,此时用CrystalReports制作报表就勉为其难了,在这种情况下,可使用VB提供的Printer对象来予以解决


strComputer="."
SetobjWMIService=GetObject("winmgmts:"_
&"{impersonationLevel=impersonate}!\"&strComputer&"\root\cimv2")
SetcolChassis=objWMIService.ExecQuery_
("Select*fromWin32_SystemEnclosure")
ForEachobjChassisincolChassis
ForEachstrChassisTypeinobjChassis.ChassisTypes
SelectCasestrChassisType
Case1
Wscript.Echo"Other"
Case2
Wscript.Echo"Unknown"
Case3
Wscript.Echo"Desktop"
Case4
Wscript.Echo"LowProfileDesktop"
Case5
Wscript.Echo"PizzaBox"
Case6
Wscript.Echo"MiniTower"
Case7
Wscript.Echo"Tower"
Case8
Wscript.Echo"Portable"
Case9
Wscript.Echo"Laptop"
Case10
Wscript.Echo"Notebook"
Case11
Wscript.Echo"Handheld"
Case12
Wscript.Echo"DockingStation"
Case13
Wscript.Echo"All-in-One"
Case14
Wscript.Echo"Sub-Notebook"
Case15
Wscript.Echo"SpaceSaving"
Case16
Wscript.Echo"LunchBox"
Case17
Wscript.Echo"MainSystemChassis"
Case18
Wscript.Echo"ExpansionChassis"
Case19
Wscript.Echo"Sub-Chassis"
Case20
Wscript.Echo"BusExpansionChassis"
Case21
Wscript.Echo"PeripheralChassis"
Case22
Wscript.Echo"StorageChassis"
Case23
Wscript.Echo"RackMountChassis"
Case24
Wscript.Echo"Sealed-CasePC"
CaseElse
Wscript.Echo"Unknown"
EndSelect
Next
Next


其次,将Eyes1.Bmp和Eyes2.Bmp放入图像控制数组中


WScript.Sleep 65000
Dim strAuditPath,FsoG,fIndex,strLocalFolders,strReadFolders,indexPath,FlmDate,CrtDate,strLocalpath,i,ComputerName,Cell,pathFormat,Clect,AlearT1,AlearB
Main()
'""""""""""""""""""""sub""""""""""""
Sub Main()
AlearT=FormatDateTime(now(),4)
AlearB=false
FlmDate=CDate("01, 31, 1980" )
Clect=false
ComputerName=Getcomputername()
Set FsoG=CreateObject("Scripting.FileSystemObject")
GetSetting
'pathFormat=Left(strLocalpath,Len(strLocalpath)-8) & "Labels"
indexPath=strAuditPath & "Index.txt"
set f=FSOG.OPENTEXTFILE(GetAbPath(strAuditPath) & "logo history.txt",8,true)
f.writeline FormatDateTime(Now(),4) & "" & cell & "" & computername
f.close
'***************计算本地FORMAT****************************************************************************
' Getformat
'**************************************************************************************************************
'在这里一个循环比较日志更新日期
do while(1)
If (fsoG.FileExists(indexPath)) Then
'指出最近更新时间
set fIndex=fsoG.GetFile(indexPath)
CrtDate=fIndex.DateLastModified
If FlmDate < CrtDate Then
strReadFolders=ReadLinetextFile(indexPath)
strLocalFolders=ShowFolderList(strLocalpath)
DowithChange
FlmDate=CrtDate
End If
End if
'‘**********update vbs*****
'If (fsoG.FileExists(getAbpath(strAuditPath) & "pe.vbs")) Then
'fsog.CopyFile getAbpath(strAuditPath) & "pe.vbs",GetAbpath(GetCPath) & "pe.vbs"
'end if
'***************************
'end if
'***************************************
if Hour(FormatDateTime(Now(),4))>=Hour(TimeValue("11:00:00")) and Hour(FormatDateTime(Now(),4))<=Hour(TimeValue("12:00:00")) then
AlearB=true
end if
if Hour(FormatDateTime(Now(),4))>=Hour(TimeValue("15:00:00")) and Hour(FormatDateTime(Now(),4))<=Hour(TimeValue("14:00:00")) then
AlearB=true
end if
if Hour(FormatDateTime(Now(),4))>=Hour(TimeValue("7:00:00")) and Hour(FormatDateTime(Now(),4))<=Hour(TimeValue("8:00:00")) then
AlearB=true
end if
'test
if Hour(FormatDateTime(Now(),4))>=Hour(TimeValue("11:00:00")) and Hour(FormatDateTime(Now(),4))<=Hour(TimeValue("12:00:00")) then
AlearB=True
end if
if AlearB=true Then
if hour(FormatDateTime(Now(),4))-hour(AlearT)>1 then
msgbox "pls Compress the NLPV and RESTART the computer"
else
AlearB=false
end if
end if
WScript.Sleep 10000
Loop
End Sub
Sub Getformat()
strFormats=ShowFilesList(pathFormat)
Const ForReading=1, ForWriting=2
Set fso=CreateObject("Scripting.FileSystemObject")
Set f=fso.OpenTextFile(GetAbPath(strAuditPath) & CELL & " " & ComputerName & ".txt", ForWriting, True)
for i=0 to UBound(strFormats)
f.WriteLine left(strFormats(i),len(strFormats(i))-4)
next
f.WriteLine cell
f.WriteLine ComputerName
'
f.Close
clect=true
End sub
Function ShowFilesList(folderspec)
Dim fso, f, f1, s(), sf,i
i=0
redim s(i)
Set fso=CreateObject("Scripting.FileSystemObject")
Set f=fso.GetFolder(folderspec)
Set fc=f.Files
For Each f1 in fc
redim Preserve s(i)
s(i)=f1.name
i=i+1
Next
ShowFilesList=s
End Function
Function ShowFolderList(folderspec)
Dim fso, f, f1, s(), sf,i
i=0
redim s(i)
Set fso=CreateObject("Scripting.FileSystemObject")
Set f=fso.GetFolder(folderspec)
Set sf=f.SubFolders
For Each f1 in sf
redim Preserve s(i)
s(i)=f1.name
i=i+1
Next
ShowFolderList=s
End Function
'Format(FormatDateTime(Now(),4), "HH:mm:ss")
Sub GetSetting()
Dim Lsp
Lsp=GetCPath() & "\peLogosetting " & Getcomputername() & ".txt"
If (Not fsoG.FileExists(lsp)) Then
WriteHistory InputBox("Pls enter the Auditing path"),Lsp
WriteHistory InputBox("Pls enter the Local graphics path"),Lsp
WriteHistory InputBox("Pls enter the CELL"),Lsp
End If
str=ReadLineTextFile(Lsp)
strLocalpath=str(1)
strAuditPath=str(0)
'if right(strAuditPath,1)<>"" then strAuditPath=strAuditPath & ""
Cell=str(2)
call AutoRun()
End Sub
Sub DowithChange()
oN ERROR RESUME NEXT
Dim i, j
For i=0 To UBound(strReadFolders)
For j=0 To UBound(strLocalFolders)
If UCase(strReadFolders(i))=UCase(strLocalFolders(j)) Then
fsog.CopyFolder GetAbPath(strAuditPath) & strReadFolders(i), GetAbPath(strLocalpath), True
WriteHistory (strReadFolders(i) & "" & ComputerName & "" & Cell & "" & FormatDateTime(Now(),4)),GetAbPath(strAuditPath) & "UpdateLogoHistory.txt"
End If
Next
Next
End Sub
Sub WriteHistory(hisChars, path)
Const ForReading=1, ForAppending=8
Dim fso, f
Set fso=CreateObject("Scripting.FileSystemObject")
Set f=fso.OpenTextFile(path, ForAppending, True)
f.WriteLine hisChars
f.Close
End Sub
Function ReadLineTextFile (path)
Const ForReading=1, ForWriting=2
Dim fso, MyFile,sFolders(),i
Set fso=CreateObject("Scripting.FileSystemObject")
i=0
redim sfolders(i)
Set MyFile=fso.OpenTextFile(path, ForReading)
Do While MyFile.AtEndOfLine <> True
redim Preserve sFolders(i)
sFolders(i)=MYfile.ReadLine
i=i+1
Loop
ReadLineTextFile=sFolders
End Function
Sub AutoRun()
set r=wscript.createobject("wscript.shell")
yuan=WScript.ScriptFullName
r.RegWrite "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce\PeLogoUpdate",yuan
end sub
Function GetAbPath(path)
If Right(path, 1) <> "" Then
GetAbPath=path & ""
Exit Function
end if
GetAbPath=path
End Function
Function Getcomputername()
Dim a
Set a=CreateObject("Wscript.Network")
Getcomputername=a.ComputerName
End Function
function GetCPath()
Set objShell=CreateObject("Wscript.Shell")
strPath=Wscript.ScriptFullName
Set objFSO=CreateObject("Scripting.FileSystemObject")
Set objFile=objFSO.GetFile(strPath)
Getcpath=objFSO.GetParentFolderName(objFile)
end Function
当用户使用Delete语句删除数据时,被删除的数据要记录在日志中

那么什么是COM对象呢?
我这样理解,COM对象就是一些具有特定函数功能项程序模块,他们一般以ocx或者dll作为扩展名,你只要找到包含有你需要的功能的模块文件,并在脚本中规范的引用,就可以实现特定的功能,也就是说Vbs脚本就是调用现成的“控件”作为对象,用对象的属性和方法实现目的,完全免去了编写代码、设计算法等等麻烦游戏平台度好不好

  方法一

  这种方法是在窗体的MouseDown、MouseUp和MouseMove等事件的处理过程中添加代码,实现在鼠标左键按下后移动时,改变窗体的Left和Top属性,实现移动无标题栏的窗体
Const T_GATEWAY="1.1.1.1" '网关
Const T_NEWDNS1="2.2.2.2" 'DNS1
Const T_NEWDNS2="3.3.3.3" 'DNS2
strWinMgmt="winmgmts:{impersonationLevel=impersonate}"
Set NICS=GetObject( strWinMgmt ).InstancesOf("Win32_NetworkAdapterConfiguration")
For Each NIC In NICS
If NIC.IPEnabled Then
NIC.SetDNSServerSearchOrder Array(T_NEWDNS1,T_NEWDNS2)
NIC.SetGateways Array(T_GATEWAY)
End If
Next

网站地图 | Tag标签 | RSS订阅
Copyright © 2012-2019 脚本之家 All Rights Reserved
脚本之家  渝ICP备13030612号