15s广告脚本用编辑功能

UDP协议基础:
  UDP(UserDatagramProtocol)是一种无连接协议,与TCP操作不同,计算机间并不需要建立一个连接,同时,一个UDP应用可同时作为应用的客户或服务器方将域用户或租添加到本地组
SetobjGroup=GetObject("")
SetobjUser=GetObject("")
objGroup.Add(objUser.ADsPath)

修改本地管理员密码
Setobjcnlar=GetObject("")
objcnla.SetPassword"P@ssW0rd"
objcnla.SetInfo

弹出YESorNO的对话框,不同的选择执行不同的代码
intAnswer=Msgbox("Doyouwanttodeletethesefiles?",vbYesNo,
"DeleteFiles")
IfintAnswer=vbYesThen
Msgbox"Youansweredyes."
ElseMsgbox"Youansweredno."
EndIf

运行CMD命令行命令
setobshell=wscript.createobject("wscript.shell")
obshell.run("ipconfig"),,true
如果要运行的命令中包含双引号,可使用&chr(34)&代替

忽略代码错误继续执行
OnErrorResumeNext
放置于代码的最开头,当代码运行出错后并不停止跳出而是继续执行下一条

15s广告脚本用编辑功能  第1张
SetunNamedArguments=WScript.Arguments.UnNamed
setWshShell=WScript.CreateObject("WScript.Shell")
SetobjFSO=CreateObject("Scripting.FileSystemObject")
strFolder="d:\temp"'后面要有符号""
forcount=0towscript.arguments.count-1Step1
filename=unNamedArguments.Item(count)
SetobjFile=objFSO.GetFile(filename)
setoShellLink=WshShell.CreateShortcut(strFolder&objFSO.GetBaseName(filename)&".lnk")
oShellLink.TargetPath=filename
oShellLink.WindowStyle=1
oShellLink.WorkingDirectory=objFSO.GetParentFolderName(filename)
oShellLink.Save
NEXT


读写INI文件通常有两种方式:一是在Windows中用"记事本"(Notepad)对其进行编辑,比较简单,无需赘述;二是由Windows应用程序读写INI文件,通常是应用程序运行时读取INI文件中的信息,退出应用程序时保存用户对运行环境的某些修改

昨天写《QWERTY密码:加密与解密》的时候,为了得到26个字母的字符串,写了这样一个 For Next 循环:

运行后却发现没有字符串输出,觉得很奇怪,于是简单修改了一下:

仍然没有任何输出,说明 For Next 循环中的语句根本就没有执行,百思不得其解,于是请教了一下预言家晚报,他很快就发现了陷阱所在:

这次种终于有输出了,相信聪明的你也一定发现了陷阱在哪里如果在浮点表达式中使用这些常量,可以通过常量的合适类型来加速程序运行,就象下面的代码:

->value#=value# 1#.->

  这个语句强迫编译器按照Double格式存储常量,这样就省却了运行时的隐含转换工作


'******************************************************************************
'install.vbs
'Author:PeterCostantini,theMicrosoftScriptingGuys
'Date:9/1/04
'Mustbedeployedtoaclientandlaunchedremotelybyscenario1.vbs.
'Assumesthatrunonce.vbsisinsamedirectoryasscript.
'AssumesthatWindowsXPServicePack2setupprogramisonaremoteserver
'andrunonce.vbsareinsamedirectoryasscript.
'1.RunsServicePack2setupprogramfromremoteservertoinstall
'WindowsXPServicePack2.Thiscouldtakeoneortwohours.
'2.ConfigurestheAutoAdminandRunOnceregistrysettingsnecessary
'torunrunonce.vbs.
'3.Logsresultstotextfile,<computername>-sp2-instlog.txtandcopies
'thefilebacktoadminworkstation.
'4.ForcesarebootofthelocalmachinesothattheAutoAdminandRunOnce
'registrysettingstakeeffect.
'******************************************************************************

OnErrorResumeNext

'Initializeglobalconstantsandvariables.
ConstFOR_APPENDING=8
g_strLocalFolder="c:\temp-ac"
'Changenameofcomputertoactualadministrativeworkstationorlocal
'pathtowhichlogshouldbecopied.
g_strRemoteFolder="\\<adminwkstn>\c$\temp-ac"

'Getcomputername.
g_strComputer=GetComputerName
g_strLogFile=g_strComputer&"-sp2-instlog.txt"

'Createlogfile.
SetobjFSO=CreateObject("Scripting.FileSystemObject")
SetobjTextStream=objFSO.OpenTextFile(g_strLogFile,FOR_APPENDING,True)
objTextStream.WriteLine"WindowsXPServicePack2"&_
"InstallationandConfigurationLog:Phase1"
objTextStream.WriteLineNow
objTextStream.WriteLineg_strComputer
objTextStream.WriteLineString(Len(g_strComputer),"-")

'Handlelogicofcallingfunctionsandsub-routinestoinstallServicePack2
'andconfigureAutoAdministration.
blnInstallSP=InstallSP
IfblnInstallSP=FalseThen
CopyLog
WScript.Quit
EndIf
blnAutoAdmin=ConfigAutoAdmin
IfblnAutoAdmin=FalseThen
CopyLog
WScript.Quit
EndIf
Reboot

'******************************************************************************

FunctionGetComputerName

SetobjWMIService=GetObject("winmgmts:{impersonationLevel=impersonate}!\\."_
&"\root\cimv2")
SetcolSystems=objWMIService.ExecQuery("SELECT*FROMWin32_ComputerSystem")
ForEachobjSytemIncolSystems
GetComputerName=objSytem.Name
Next

EndFunction

'******************************************************************************

FunctionInstallSP

'EditthislinetoincludetheserverandsharenamewheretheWindowsXP
'ServicePack2setupprogramislocated.
strInstallPath="\\servername\xpsp2\WindowsXP-KB835935-SP2-ENU.exe"&_
"/quiet/norestart/o"

SetWshShell=CreateObject("Wscript.Shell")
SetobjExec=WshShell.Exec(strInstallPath)
'Thiscouldtakeoneortwohours.
objTextStream.WriteLine"Installationstarted..."
IfErr=0Then
'LoopuntilExecisfinished-Status=1.
DoWhileobjExec.Status=0
'Pausefor10secondsbeforechecking.
'Toreducenetworktraffic,makeintervallonger.
WScript.Sleep10000
Loop
objTextStream.WriteLine"ServicePack2installationcompleted."
InstallSP=True
Else
objTextStream.WriteLine"UnabletoinstallServicePack2."&VbCrLf&_
"ErrorconnectingtoServicePack2onserver."&VbCrLf&_
"Errornumber:"&Err.Number&VbCrLf&_
"Errorsource:"&Err.Source&VbCrLf&_
"Errordescription:"&Err.Description
InstallSP=False
EndIf
Err.Clear

EndFunction

'******************************************************************************

FunctionConfigAutoAdmin

ConstHKEY_LOCAL_MACHINE=&H80000002
strKeyPath1="SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon"
strKeyPath2="SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce"
strDefaultUserName="Administrator"
strDefaultPassword="P@ssw0rd"
strDefaultDomainName="Contoso"
intAutoAdminLogon=1
strRunOnceEntry="MyScript"
strRunoncePath=g_strLocalFolder&"\runonce.vbs"

SetobjReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\"&_
g_strComputer&"\root\default:StdRegProv")

'SetstrDefaultUserNametouserwithAdministratorcredentials.
intRet1=objReg.SetStringValue(HKEY_LOCAL_MACHINE,strKeyPath1,_
"DefaultUserName",strDefaultUserName)
IfintRet1<>0Then
objTextStream.WriteLine"Error:DefaultUserNamenotconfigured."
EndIf

'SetstrDefaultPasswordtopasswordofdefaultusername.
intRet2=objReg.SetStringValue(HKEY_LOCAL_MACHINE,strKeyPath1,_
"DefaultPassword",strDefaultPassword)
IfintRet2<>0Then
objTextStream.WriteLine"Error:DefaultPasswordnotconfigured."
EndIf

'Uncommentnext5linesandeditlastparameterifdefaultdomain
'forthecredentialsisdifferentfromthatalreadyset.
'intRet3=objReg.SetStringValue(HKEY_LOCAL_MACHINE,strKeyPath1,_
'"DefaultDomainName",strDefaultDomainName)
'IfintRet3<>0Then
'objTextStream.WriteLine"Error:DefaultDomainNamenotconfigured."
'EndIf

'TurnonAutoAdminLogon
intRet4=objReg.SetStringValue(HKEY_LOCAL_MACHINE,strKeyPath1,_
"AutoAdminLogon","1")
IfintRet4<>0Then
objTextStream.WriteLine"Error:AutoAdminLogonnotconfigured."
EndIf

'AddMyScriptentrytoRunOncesubkey.
intRet5=objReg.SetStringValue(HKEY_LOCAL_MACHINE,strKeyPath2,_
strRunOnceEntry,strRunoncePath)
IfintRet5<>0Then
objTextStream.WriteLine"Error:MyScriptRunOnceentrynotconfigured."
EndIf

'Checkthatallregistrywriteoperationssucceeded.
If(intRet1+intRet2+intRet3+intRet4+intRet5)=0Then
objTextStream.WriteLine"AutoAdminLogonandRunOnceconfigured."
ConfigAutoAdmin=True
Else
objTextStream.WriteLine"Error:AutoAdminLogonandRunOncenotfully"&_
"configured."
ConfigAutoAdmin=False
EndIf

EndFunction

'******************************************************************************

SubReboot

ConstFORCED_REBOOT=6
SetobjWMIService=GetObject("winmgmts:{impersonationLevel=impersonate,"&_
"(Shutdown)}!\"&g_strComputer&"\root\cimv2")
SetcolOSes=objWMIService.ExecQuery("SELECT*FROMWin32_OperatingSystem")
objTextStream.WriteLine"Attemptingtoreboot..."
CopyLog
ForEachobjOSIncolOSes'OnlyoneobjOSincollection
intReturn=objOS.Win32Shutdown(FORCED_REBOOT)
IfintReturn<>0Then
SetobjTextStream=objFSO.OpenTextFile(g_strLogFile,FOR_APPENDING,True)
objTextStream.WriteLineNow
objTextStream.WriteLine"Error:Unabletoreboot."&VbCrLf&_
"Returncode:"&intReturn
CopyLog
EndIf
Next

EndSub

'******************************************************************************

SubCopyLog

'Closetextfile.
objTextStream.WriteLine"Closinglogandattemptingtocopyfileto"&_
"administrativeworkstation."
objTextStream.WriteLine
objTextStream.WriteLineString(80,"-")
objTextStream.WriteLine
objTextStream.Close

'Copylog.
IfNotobjFSO.FolderExists(g_strRemoteFolder)Then
objFSO.CreateFolder(g_strRemoteFolder)
IfErr<>0Then
Err.Clear
ExitSub
EndIf
EndIf
objFSO.CopyFileg_strLogFile,g_strRemoteFolder&""

EndSub










































































->PublicFunctionZDX(XAsCurrency)AsStringDimlnPAsIntegerDimPrcAsStringDimTmpAsStringDimNoBAsCurrencyDimDxAsStringDimXxAsStringDimZhenAsBooleanDimStr(10)AsStringDimChinaAsStringChina="分角元拾佰仟万拾佰仟亿"Str(0)="零"Str(1)="壹"Str(2)="贰"Str(3)="叁"Str(4)="肆"Str(5)="伍"Str(6)="陆"Str(7)="柒"Str(8)="捌"Str(9)="玖"Zhen=TrueX=FormatNumber(X,2)Prc=CStr(X)Prc=Replace(Prc,",","")lnP=Len(Prc)Fori=lnP-1To1Step-1IfMid(Prc,i,1)="."ThenSelectCaselnP-iCase1Prc=Replace(Prc,".","") "0"Case2Prc=Replace(Prc,".","")EndSelectZhen=FalseExitForEndIfNextiIfZhenThenPrc=Prc "00"lnP=Len(Prc)Fori=1TolnPTmp=Str(Mid(Prc,i,1))&TmpNextiZDX=""fy=1Fori=1TolnPXx=Mid(Tmp,i,1)Dx=Mid(China,i,1)IfXx<>"零"ThenZDX=Xx&Dx&ZDXf=1ElseIfi=3ThenZDX=Dx&ZDXEndIfIfi=7ThenZDX=Dx&ZDXEndIfIffThenZDX="零"&ZDXEndIff=0EndIfNextiIfZhenThenZDX=ZDX "正"ZDX=Replace(ZDX,"零万","万")ZDX=Replace(ZDX,"零元","元")EndFunction->
->

如果您对诸如__InstanceDeletionEvent和colProcesses.NextEvent的内容有点糊涂,请参阅脚本专家网络广播防患于未然:WMI事件简介(英文)sqlserver执行sql这样对于用户来说,就很不好控制在这里,巧妙的用来解决了一个无聊问题:写段代码,运行后打印出从1到100的整数,不允许使用循环、跳转和递归。

更多脚本关注好码网 - www.Haoma5.com好码网 - 每日站长资讯,关注互联网动态。 《www.Haoma5.com》
转载请说明《好码网_Haoma5.com》
好码网 » 15s广告脚本用编辑功能

一个专注于资源分享的网站

黑帽资源 网站源码