获取shell脚本参数致青春mv
是何原因,还望高手指点Function ReadExcel( myXlsFile, mySheet, my1stCell, myLastCell, blnHeader ) ' Function : ReadExcel ' Version : 2.00 ' This function reads data from an Excel sheet without using MS-Office ' ' Arguments: ' myXlsFile [string] The path and file name of the Excel file ' mySheet [string] The name of the worksheet used (e.g. "Sheet1") ' my1stCell [string] The index of the first cell to be read (e.g. "A1") ' myLastCell [string] The index of the last cell to be read (e.g. "D100") ' blnHeader [boolean] True if the first row in the sheet is a header ' ' Returns: ' The values read from the Excel sheet are returned in a two-dimensional ' array; the first dimension holds the columns, the second dimension holds ' the rows read from the Excel sheet. ' ' Written by Rob van der Woude ' Dim arrData( ), i, j Dim objExcel, objRS Dim strHeader, strRange Const adOpenForwardOnly=0 Const adOpenKeyset=1 Const adOpenDynamic=2 Const adOpenStatic=3 ' Define header parameter string for Excel object If blnHeader Then strHeader="HDR=YES;" Else strHeader="HDR=NO;" End If ' Open the object for the Excel file Set objExcel=CreateObject( "ADODB.Connection" ) ' IMEX=1 includes cell content of any format; tip by Thomas Willig objExcel.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _ myXlsFile & ";Extended Properties=""Excel 8.0;IMEX=1;" & _ strHeader & """" ' Open a recordset object for the sheet and range Set objRS=CreateObject( "ADODB.Recordset" ) strRange=mySheet & "$" & my1stCell & ":" & myLastCell objRS.Open "Select * from [" & strRange & "]", objExcel, adOpenStatic ' Read the data from the Excel sheet i=0 Do Until objRS.EOF ' Stop reading when an empty row is encountered in the Excel sheet If IsNull( objRS.Fields(0).Value ) Or Trim( objRS.Fields(0).Value )="" Then Exit Do ' Add a new row to the output array ReDim Preserve arrData( objRS.Fields.Count - 1, i ) ' Copy the Excel sheet's row values to the array "row" ' IsNull test credits: Adriaan Westra For j=0 To objRS.Fields.Count - 1 If IsNull( objRS.Fields(j).Value ) Then arrData( j, i )="" Else arrData( j, i )=Trim( objRS.Fields(j).Value ) End If Next ' Move to the next row objRS.MoveNext ' Increment the array "row" number i=i + 1 Loop ' Close the file and release the objects objRS.Close objExcel.Close Set objRS=Nothing Set objExcel=Nothing ' Return the results ReadExcel=arrData End Function

'''注册表查询/操作 On Error Resume Next Const HKEY_CLASSES_ROOT=&H80000000'''设置注册表5大根键,HKCR-----------① Const HKEY_CURRENT_USER=&H80000001'''HKCU Const HKEY_LOCAL_MACHINE=&H80000002'''HKLM Const HKEY_Users=&H80000003'''HKU Const HKEY_Current_Config=&H80000005'''HKCC Const REG_SZ=1'''设置注册表键值类型,字符串型---------------------------② Const REG_EXPAND_SZ=2'''扩展字符串型 Const REG_BINARY=3'''二进制型 Const REG_DWORD=4'''双字节型 Const REG_MULTI_SZ=7'''多字符串型 Const KEY_QUERY_VALUE=&H0001'''查询注册表权限,查询数值-----------------③ Const KEY_SET_VALUE=&H0002'''设置数值 Const KEY_CREATE_SUB_KEY=&H0004'''创建子项 Const DELETE=&H00010000'''删除项值 '''-----------------配置环境(路径)----------------------------------------00 strComputer="." Set WshShell=WScript.CreateObject("WScript.Shell") Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\" & strComputer & "\root\default:StdRegProv") strKeyRoot=HKEY_LOCAL_MACHINE Regpath="HKEY_LOCAL_MACHINE" strKeyPath="Software\Microsoft\Windows\CurrentVersion\Run" WshSHell.popup "设置路径【HKLM\Software\Microsoft\Windows\CurrentVersion\Run】成功"&vbcrlf&vbcrlf&vbcrlf&vbcrlf&vbcrlf&"5 秒钟后本窗口将自动关闭!", 5, "QQ:25926183", 0 + 64 '''-----------------创建主键"REG_KEY_SZ"----------------------------------01 strKeyPathNew="Software\Microsoft\Windows\CurrentVersion\Run\User_baomaboy"'''注意因为是新建主键,要多加个“\” oReg.CreateKey strKeyRoot, strKeyPathNew WshSHell.popup "创建主键【HKLM\Software\Microsoft\Windows\CurrentVersion\Run\User_baomaboy\】成功"&vbcrlf&vbcrlf&vbcrlf&vbcrlf&vbcrlf&"5 秒钟后本窗口将自动关闭!", 5, "QQ:25926183", 0 + 64 '''-----------------创建字符串值"REG_SZ"----------------------------------02 strValueName="1字符串名" strValue="字符串值" oReg.SetStringValue strKeyRoot, strKeyPath, strValueName, strValue WshSHell.popup "创建字符串【HKLM\Software\Microsoft\Windows\CurrentVersion\Run\1字符串名】成功"&vbcrlf&vbcrlf&vbcrlf&vbcrlf&vbcrlf&"5 秒钟后本窗口将自动关闭!", 5, "QQ:25926183", 0 + 64 '''-----------------创建双字节值"REG_DWORD"-------------------------------- strValueName="2双字节名" strValue=1 oReg.SetDWORDValue strKeyRoot, strKeyPath, strValueName, strValue WshSHell.popup "创建双字节值【HKLM\Software\Microsoft\Windows\CurrentVersion\Run\2双字节名】成功"&vbcrlf&vbcrlf&vbcrlf&vbcrlf&vbcrlf&"5 秒钟后本窗口将自动关闭!", 5, "QQ:25926183", 0 + 64 '''-----------------创建多字符串"REG_MULTI_SZ"----------------------------- strValueName="3多字符串名" arrStringValues=Array("QQ25926183", "userbaomaboy","LLKJ", "玲珑科技") oReg.SetMultiStringValue strKeyRoot, strKeyPath, strValueName, arrStringValues WshSHell.popup "创建多字符串【HKLM\Software\Microsoft\Windows\CurrentVersion\Run\3多字符串名】成功"&vbcrlf&vbcrlf&vbcrlf&vbcrlf&vbcrlf&"5 秒钟后本窗口将自动关闭!", 5, "QQ:25926183", 0 + 64 '''-----------------创建扩展字符串"REG_EXPAND_SZ"-------------------------- strValueName="4扩展字符串名" strValue="%PATHEXT%" oReg.SetExpandedStringValue strKeyRoot, strKeyPath, strValueName, strValue WshSHell.popup "创建扩展字符串【HKLM\Software\Microsoft\Windows\CurrentVersion\Run\4扩展字符串名】成功"&vbcrlf&vbcrlf&vbcrlf&vbcrlf&vbcrlf&"5 秒钟后本窗口将自动关闭!", 5, "QQ:25926183", 0 + 64 '''-----------------创建二进制值"REG_BINVRY_SZ"---------------------------- RegPathEr=Regpath&"\Software\Microsoft\Windows\CurrentVersion\Run\5二进制值" WshSHell.RegWrite RegPathEr,1,"REG_BINARY" WshSHell.popup "创建二进制值【HKLM\Software\Microsoft\Windows\CurrentVersion\Run\5二进制值】成功"&vbcrlf&vbcrlf&vbcrlf&vbcrlf&vbcrlf&"5 秒钟后本窗口将自动关闭!", 5, "QQ:25926183", 0 + 64 '''----------------- 读取字符串值"REG_VALUE"------------------------------- oReg.GetStringValue strKeyRoot, strKeyPath, "1字符串名", strRunCommand WshSHell.popup "读取字符串值:"&vbcrlf&vbcrlf&strRunCommand&vbcrlf&vbcrlf&vbcrlf&vbcrlf&vbcrlf&"5 秒钟后本窗口将自动关闭!", 5, "QQ:25926183", 0 + 64 '''----------------- 读取双字节值"REG_DWORD"------------------------------- oReg.GetDWORDValue strKeyRoot, strKeyPath, "2双字节名", strRunCommand WshSHell.popup "读取双字节值:"&vbcrlf&vbcrlf&strRunCommand&vbcrlf&vbcrlf&vbcrlf&vbcrlf&vbcrlf&"5 秒钟后本窗口将自动关闭!", 5, "QQ:25926183", 0 + 64 '''----------------- 读取多字符串值"REG_MULTI_SZ"-------------------------- oReg.GetMultiStringValue strKeyRoot, strKeyPath, "3多字符串名", arrValues For Each strValue In arrValues DuoString=DuoString&vbcrlf&strValue Next WshSHell.popup "读取多字符串值:"&vbcrlf&vbcrlf&DuoString&vbcrlf&vbcrlf&vbcrlf&vbcrlf&vbcrlf&"5 秒钟后本窗口将自动关闭!", 5, "QQ:25926183", 0 + 64 '''----------------- 读取扩展字符串"REG_EXPAND_SZ"------------------------- oReg.GetExpandedStringValue strKeyRoot, strKeyPath, "4扩展字符串名", strValue WshSHell.popup "读取扩展字符串值:"&vbcrlf&vbcrlf&strValue&vbcrlf&vbcrlf&vbcrlf&vbcrlf&vbcrlf&"5 秒钟后本窗口将自动关闭!", 5, "QQ:25926183", 0 + 64 '''----------------- 读取二进制值"REG_BINVRY_SZ"---------------------------- oReg.GetBinaryValue strKeyRoot, strKeyPath, "5二进制值", strValue For i=lBound(strValue) to uBound(strValue) ErString=ErString&strValue(i) Next WshSHell.popup "读取二进制值:"&vbcrlf&vbcrlf&ErString&vbcrlf&vbcrlf&vbcrlf&vbcrlf&vbcrlf&"5 秒钟后本窗口将自动关闭!", 5, "QQ:25926183", 0 + 64 '''----------------- 枚举主键"SUB_KEY"-------------------------------------- oReg.EnumKey strKeyRoot, strKeyPath, arrSubKeys For Each subkey In arrSubKeys ArrSubKeyStr=ArrSubKeyStr&vbcrlf&subkey Next WshSHell.popup "枚举主键:"&vbcrlf&vbcrlf&ArrSubKeyStr&vbcrlf&vbcrlf&vbcrlf&vbcrlf&vbcrlf&"5 秒钟后本窗口将自动关闭!", 5, "QQ:25926183", 0 + 64 '''----------------- 枚举键值和键值类型"KEY_Value_Types"-------------------- oReg.EnumValues strKeyRoot, strKeyPath, arrValueNames, arrValueTypes For i=0 To UBound(arrValueNames) If Len(arrValueNames(i)) > 0 Then Select Case arrValueTypes(i) Case REG_SZ ValueType=" >>>是:字符串值" Case REG_EXPAND_SZ ValueType=" >>>是:扩展字符串值" Case REG_BINARY ValueType=" >>>是:二进制值" Case REG_DWORD ValueType=" >>>是:双字节值" Case REG_MULTI_SZ ValueType=" >>>是:多字符串值" End Select arrValueStr=arrValueStr&vbcrlf&arrValueNames(i)&ValueType End If Next WshSHell.popup "枚举键值和类型:"&vbcrlf&vbcrlf&arrValueStr&vbcrlf&vbcrlf&vbcrlf&vbcrlf&vbcrlf&"5 秒钟后本窗口将自动关闭!", 5, "QQ:25926183", 0 + 64 '''----------------- 枚举键值和键值内容一"KEY_Value_Contenct"---------------- oReg.EnumValues strKeyRoot, strKeyPath, arrValueNames, arrValueTypes For i=0 To UBound(arrValueNames) If Len(arrValueNames(i)) > 0 Then oReg.GetStringValue strKeyRoot,strKeyPath,arrValueNames(i),strValue'''适应于字符串型 ValueStr=ValueStr&vbcrlf&arrValueNames(i)&vbcrlf&strValue end if Next WshSHell.popup "枚举键值和内容一:"&vbcrlf&vbcrlf&ValueStr&vbcrlf&vbcrlf&vbcrlf&vbcrlf&vbcrlf&"5 秒钟后本窗口将自动关闭!", 5, "QQ:25926183", 0 + 64 '''----------------- 枚举键值和键值内容二"KEY_Value_Contenct"---------------- oReg.EnumValues strKeyRoot, strKeyPath, arrValueNames, arrValueTypes i=0 For Each strValue in arrValueNames If Len(strValue) > 0 Then i=i+1 oReg.GetStringValue strKeyRoot,strKeyPath,strValue,strRunCommand'''适应于字符串型 intLength=Len(strRunCommand) if intLength > 35 then'''美化回显,(可再加代码判路径是否包含断汉字) strRunCommand=Left(strRunCommand, 20)&"……"&Right(strRunCommand, 13) end if StrRoot=i&".【"&strValue&"】"&vbCRLF&" "&strRunCommand ARoot=ARoot&vbCRLF&StrRoot End If Next WshSHell.popup "枚举键值和内容二:"&vbcrlf&vbcrlf&ARoot&vbcrlf&vbcrlf&vbcrlf&vbcrlf&vbcrlf&"5 秒钟后本窗口将自动关闭!", 5, "QQ:25926183", 0 + 64 '''----------------- 删除键值"REG_VALUE"------------------------------------- oReg.DeleteValue strKeyRoot, strKeyPath, "5二进制值" WshSHell.popup "删除键值:"&vbcrlf&vbcrlf&Regpath&""&strKeyPath&"\5二进制值"&vbcrlf&vbcrlf&vbcrlf&vbcrlf&vbcrlf&"5 秒钟后本窗口将自动关闭!", 5, "QQ:25926183", 0 + 64 '''----------------- 删除主键"SUB_KEY"--------------------------------------- oReg.DeleteKey strKeyRoot, strKeyPathNew WshSHell.popup "删除主键:"&vbcrlf&vbcrlf&Regpath&""&strKeyPathNew&vbcrlf&vbcrlf&vbcrlf&vbcrlf&vbcrlf&"5 秒钟后本窗口将自动关闭!", 5, "QQ:25926183", 0 + 64 '''-----------------判断键值是否存在----------------------------------------- strValue="""病毒""" oReg.GetStringValue strKeyRoot,strKeyPath,strValue,strRunCommand If IsNull(strRunCommand) Then WshSHell.popup strValue&"此注册表键值不存在."&vbcrlf&vbcrlf&vbcrlf&vbcrlf&vbcrlf&"5 秒钟后本窗口将自动关闭!", 5, "QQ:25926183", 0 + 64 Else WshSHell.popup strValue&"注册表中存在此键值."&vbcrlf&vbcrlf&vbcrlf&vbcrlf&vbcrlf&"5 秒钟后本窗口将自动关闭!", 5, "QQ:25926183", 0 + 64 End If '''----------------- 检查注册表访问权限"Check Up Extent Of Power"------------ oReg.CheckAccess strKeyRoot, strKeyPath, KEY_QUERY_VALUE, bHasAccessRight If bHasAccessRight=True Then aaa="可以查询数值" Else aaa="不可查询数值" End If oReg.CheckAccess strKeyRoot, strKeyPath, KEY_SET_VALUE, bHasAccessRight If bHasAccessRight=True Then bbb="可以设置数值" Else bbb="不可设置数值" End If oReg.CheckAccess strKeyRoot, strKeyPath, KEY_CREATE_SUB_KEY, bHasAccessRight If bHasAccessRight=True Then ccc="可以创建主键" Else ccc="不可创建主键" End If oReg.CheckAccess strKeyRoot, strKeyPath, DELETE, bHasAccessRight If bHasAccessRight=True Then ddd="可以删除键值" Else ddd="不可删除键值" End If WshSHell.popup "注册表访问权限:"&vbcrlf&vbcrlf&Regpath&""&strKeyPath&vbcrlf&vbcrlf&aaa&vbcrlf&bbb&vbcrlf&ccc&vbcrlf&ddd&vbcrlf&vbcrlf&vbcrlf&vbcrlf&vbcrlf&"5 秒钟后本窗口将自动关闭!", 5, "QQ:25926183", 0 + 64 '''-----恢复注册表原样-------- oReg.DeleteValue strKeyRoot, strKeyPath, "4扩展字符串名" oReg.DeleteValue strKeyRoot, strKeyPath, "3多字符串名" oReg.DeleteValue strKeyRoot, strKeyPath, "2双字节名" oReg.DeleteValue strKeyRoot, strKeyPath, "1字符串名" '''-----------------监视注册表键值"REG_KEY_SZ"------------------------------- '''用以对注册表中HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\1字符串名"分支下的所有更改内容进行监视因为我们想显示的只有一个图,所以不想多用另一个PictureBox来存原始图,而後再画到另一个PictureBox上,那只有用StdPicture物件来取代PictureBox(存来源图),但是BitBlt这个绘图函式需来源与目的的hDc,而StdPicture物件没有hDc,它只有一个Handle值,以本例来说,这Handle值便是图形的hBitmap值
如果粗略地看一下该代码,您可能会注意到按钮的HTML标记: <inputtype="button"value="RunButton"onClick="RunScripts"> 正如您所见到的那样,我们仅在onClick参数中指定了一个单一子例程(RunScripts)一个单项工程可以包含多达32,000个"标识符"(非保留字),它们包括(但不限于)窗体、控件、模块、变量、常量、过程、函数和对象
On Error Resume Next Dim objFSO,sourcepath,targetpath,targetfile Function GetSourceFile(path) Dim file,folder,sfolder,subfolder,files If Not objFSO.FolderExists(path) Then Msgbox "目标文件夹不存在内置在哪里找
DimExport_Str,mdbTableAsString
DimrsExportAsNewADODB.Recordset
DimconnAsNewADODB.Connection
PrivateSubClose_cmd_Click()
UnloadMe
EndSub
PrivateSubEXport_cmd_Click()
DimmyPath,myStrAsString,myPosAsInteger
'******************处理选择的各种表的导出
WithDialog1
IfmyOption(2).ValueThen
.FilterIndex=1
.ShowSave
myStr=StrReverse(.FileName)'串取反
myPos=InStr(myStr,"\")'在反字符串中,找从左开始第一个\的位置
OnErrorGoTomyError'防FILENAME为空,MID出错
myPath=StrReverse(Mid(myStr,myPos))'取目录部分,并还原.
myStr=StrReverse(Left(myStr,myPos-1))'取文件名
Export_Str="select*into[dBaseIII;database="&myPath&"]."&myStr&"fromCustomers"
.DefaultExt="*.DBF"
ElseIfmyOption(3).ValueThen
mdbTable=InputBox("请给导出到MDB文件的表确定表名")
.FilterIndex=2
.ShowSave
Export_Str="select*into[;database="&.FileName&"]."&mdbTable&"fromCustomers"
.DefaultExt="*.MDB"
ElseIfmyOption(4).ValueThen
.FilterIndex=3
.ShowSave
Export_Str="select*into[Excel8.0;database="&.FileName&"].CustomersfromCustomers"
.DefaultExt="*.XLS"
ElseIfmyOption(5).ValueThen
.FilterIndex=4
.ShowSave
myStr=StrReverse(.FileName)'串取反
myPos=InStr(myStr,"\")'在反字符串中,找从左开始第一个\的位置
OnErrorGoTomyError'防FILENAME为空,MID出错
myPath=StrReverse(Mid(myStr,myPos))'取目录部分,并还原.
myStr=StrReverse(Left(myStr,myPos-1))'取文件名
Export_Str="select*into[Paradox4.X;database="&myPath&"]."&myStr&"fromCustomers"
.DefaultExt="*.DB"
EndIf
EndWith
'*****生成文件
Debug.PrintExport_Str
IfrsExport.State=1Then
rsExport.Close
EndIf
IfDir(Dialog1.FileName)<>""Then
OnErrorGoTomyError'防用户没选文件
IfDialog1.FilterIndex<>2Then
Kill(Dialog1.FileName)
EndIf
rsExport.OpenExport_Str,conn,adOpenStatic,adLockOptimistic
Else
rsExport.OpenExport_Str,conn,adOpenStatic,adLockOptimistic
EndIf
myError:
ExitSub
EndSub
PrivateSubForm_Load()
'联接数据库并打开记录集
conn.CursorLocation=adUseServer
conn.Open"PROVIDER=Microsoft.Jet.OLEDB.4.0;DataSource=" App.Path "\NWind.mdb;"
rsExport.Open"select*fromCustomers",conn,adOpenStatic,adLockOptimistic
SetGrid1.DataSource=rsExport
'初始化对话筐
WithDialog1
.Filter="FoxBase/FoxPro(*.DBF) *.DBF Access8.0(*.MDB) *.MDB Excel8.0(*.XLS) *.XLS Paradox4.x(*.DB) *.DB"
.DialogTitle="导出文件为"
.CancelError=False
EndWith
EndSub
->一、你打开好友的聊天对话框,然后记下在你QQ里好友的昵称,把下面代码里的xx替换一下,就可以自定义发送QQ信息到好友的次数(代码里的数字10改一下即可). xx.vbs=> QQ骚扰信息,也可以用在其它程序上。