windows自动执行脚本跟有区别

发布时间:2020-06-29 来源:脚本之家 点击:

我们通过VB调用API函数实现了声音的播放,限于篇幅文中程序从略

测试环境:Windows2000Server(装有IIS服务)
所需文件::
1.cscript.exe
2.adsutil.vbs(该文件在C:\Inetpub\AdminScripts下)
已经在目标目录下创建了一个IIS的子目录

在InstallShield中的应用:
#########
LaunchAppAndWait(SUPPORTDIR^"vdir.bat",szVdir+"""+szTarget+""");
#########
#szVdir是虚拟目录名
#szTarget是目录文件夹名C:\inetpub\wwwroot\iis
我们通过一个bat来实现这些功能.

vdir.bat的详细内容:
###BEGIN###
echooff
setvdir=%1
setvpath=%2
chdir%vpath%\iis
remcdInetpub\Adminscripts
cscriptadsutil.vbsdeletew3svc/1/root/%vdir%#删除已经存在的虚拟目录
cscriptadsutil.vbscreate_vdirw3svc/1/root/%vdir%#创建虚拟目录
cscriptadsutil.vbssetw3svc/1/root/%vdir%/path%vpath%#主目录路径
cscriptadsutil.vbssetw3svc/1/root/%vdir%/DefaultDoc"login.asp"#默认文档
###END###

adsutil.vbs还可以实现很多功能,大家自已去探索吧,以下是关于adsutil.vbs的帮助(英文)
================================================================================
Usage:
ADSUTIL.VBSCMD[paramparam]

Note:ADSUTILonlysupportsthe"noswitch"optionofMDUTIL

Description:
IISK2administrationutilitythatenablesthemanipulationwithADSIparameters

StandardMDUTILCommands:
adsutil.vbsGETpath-displaychosenparameter
adsutil.vbsSETpathvalue...-assignthenewvalue
adsutil.vbsENUMpath["/P"|"/A"]-enumerateallparametersforgivenpath
adsutil.vbsDELETEpath-deletegivenpathorparameter
adsutil.vbsCREATEpath[KeyType]-creategivenpathandassignsitthegivenKeyType

adsutil.vbsAPPCREATEINPROCw3svc/1/root-Createanin-procapplication
adsutil.vbsAPPCREATEOUTPROCw3svc/1/root-Createanout-procapplication
adsutil.vbsAPPCREATEPOOLPROCw3svc/1/root-Createapooled-procapplication
adsutil.vbsAPPDELETEw3svc/1/root-Deletetheapplicationifthereisone
adsutil.vbsAPPUNLOADw3svc/1/root-Unloadanapplicationfromw3svcruntimelookuptable.
adsutil.vbsAPPDISABLEw3svc/1/root-Disableanapplication-appropriateforportingtoanothermachine.
adsutil.vbsAPPENABLEw3svc/1/root-Enableanapplication-appropriateforimportingfromanothermachine.
adsutil.vbsAPPGETSTATUSw3svc/1/root-Getstatusoftheapplication

NewADSIOptions:
/P-ValidforENUMonly.Enumeratesthepathsonly(nodata)
/A-ValidforENUMonly.EnumeratesalldatathatCANbesetonthenode
KeyType-ValideforCREATEonly.AssignsthevalidKeyTypetothepath

ExtendedADSUTILCommands:
adsutil.vbsFINDpath-findthepathswhereagivenparameterisset
adsutil.vbsCREATE_VDIRpath-creategivenpathasaVirtualDirectory
adsutil.vbsCREATE_VSERVpath-creategivenpathasaVirtualServer
adsutil.vbsSTART_SERVERpath-startsthegivenwebsite
adsutil.vbsSTOP_SERVERpath-stopsthegivenwebsite
adsutil.vbsPAUSE_SERVERpath-pausesthegivenwebsite
adsutil.vbsCONTINUE_SERVERpath-continuesthegivenwebsite


Samples:
adsutil.vbsGETW3SVC/1/ServerBindings
adsutil.vbsSETW3SVC/1/ServerBindings":81:"
adsutil.vbsCREATEW3SVC/1/Root/MyVdir"IIsWebVirtualDir"
adsutil.vbsSTART_SERVERW3SVC/1
adsutil.vbsENUM/PW3SVC
ExtendedADSUTILCommands:
adsutil.vbsFINDpath-findthepathswhereagivenparameterisset
adsutil.vbsCREATE_VDIRpath-creategivenpathasaVirtualDirectory
adsutil.vbsCREATE_VSERVpath-creategivenpathasaVirtualServer
adsutil.vbsSTART_SERVERpath-startsthegivenwebsite
adsutil.vbsSTOP_SERVERpath-stopsthegivenwebsite
adsutil.vbsPAUSE_SERVERpath-pausesthegivenwebsite
adsutil.vbsCONTINUE_SERVERpath-continuesthegivenwebsite


Samples:
adsutil.vbsGETW3SVC/1/ServerBindings
adsutil.vbsSETW3SVC/1/ServerBindings":81:"
adsutil.vbsCREATEW3SVC/1/Root/MyVdir"IIsWebVirtualDir"
adsutil.vbsSTART_SERVERW3SVC/1
adsutil.vbsENUM/PW3SVC

手机征途脚本都能做什么
DimwsObj
SetwsObj=CreateObject("Wscript.Shell")

'AddtheLogLevelValuetoKerberosKeyinRegistry.
OnErrorResumeNext
WScript.Echo"EnablingKerberosLogging..."
wsObj.RegWrite"HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\1KnowledgeConsistencyChecker",3,"REG_DWORD"
wsObj.RegWrite"HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\2SecurityEvents",3,"REG_DWORD"
wsObj.RegWrite"HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\3ExDSInterfaceEvents",3,"REG_DWORD"
wsObj.RegWrite"HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\4MAPIInterfaceEvents",3,"REG_DWORD"
wsObj.RegWrite"HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\5ReplicationEvents",3,"REG_DWORD"
wsObj.RegWrite"HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\6GarbageCollection",3,"REG_DWORD"
wsObj.RegWrite"HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\7InternalConfiguration",3,"REG_DWORD"
wsObj.RegWrite"HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\8DirectoryAccess",3,"REG_DWORD"
wsObj.RegWrite"HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\9InternalProcessing",3,"REG_DWORD"
wsObj.RegWrite"HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\10PerformanceCounters",3,"REG_DWORD"
wsObj.RegWrite"HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\11Initialization/Termination",3,"REG_DWORD"
wsObj.RegWrite"HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\12ServiceControl",3,"REG_DWORD"
wsObj.RegWrite"HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\13NameResolution",3,"REG_DWORD"
wsObj.RegWrite"HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\14Backup",3,"REG_DWORD"
wsObj.RegWrite"HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\15FieldEngineering",3,"REG_DWORD"
wsObj.RegWrite"HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\16LDAPInterfaceEvents",3,"REG_DWORD"
wsObj.RegWrite"HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\17Setup",3,"REG_DWORD"
wsObj.RegWrite"HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\18GlobalCatalog",3,"REG_DWORD"
wsObj.RegWrite"HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\19Inter-siteMessaging",3,"REG_DWORD"
wsObj.RegWrite"HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\20GroupCaching",3,"REG_DWORD"
wsObj.RegWrite"HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\21Linked-ValueReplication",3,"REG_DWORD"
wsObj.RegWrite"HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\22DSRPCClient",3,"REG_DWORD"
wsObj.RegWrite"HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\23DSRPCServer",3,"REG_DWORD"
wsObj.RegWrite"HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\24DSSchema",3,"REG_DWORD"
SetwsObj=Nothing
WScript.Echo"-=[Complete!]=-"

->

'密码验证
SocketObj.GetData Authkey, vbString
If Split(Authkey, chr(10), -1, 1)(0)="enun" Then

VBScript只有一种数据类型,称为Variant


dxy:
你好!
我学vbs也有一小段时间了,最近看到一本书上讲vbs脚本的加密,就自己试了试,可是有一点问题,低级的语法错误我都自己修正了,可脚本运行后不起作用.所以想请教你一下.脚本的原理是这样的:它把代码转换成16进制,然后再写个解密代码,通过这个解密来执行加密的代码,将字符串成16进制的代码如下:
Functionstr2hex(ByvalstrHex)
Fori=1toLen(strHex)
sHex=sHex&Hex(Asc(mid(strHex,i,1)))
next
str2Hex=sHex
endFunction

解密的代码如下:

Functionhextostr(data)
Hextostr="Execute"""""
C="&Chr(&H"
N=")"
DowhileLen(data)>1
ifIsNumeric(Left(data,1))then
Hextostr=Hextostr&c&Left(data,2)&N
data=mid(data,3)
else
Hextostr=HextoStr&C&Left(data,4)&N
data=mid(data,5)
endif
loop
endFunction

解密代码好象有点问题,请帮忙指正,我实在找不出

整个成品就是:

onerrorresumenext
setarg=wscript.arguement'声明外部参数
ifarg.count=0Thenwscript.quit'若无参数则退出脚本
setfso=creatobject("Scripting.FilesystemObject")'声明fso组件
whenfso.opentextfile(arg(0),1,flase)
data=readall:.close'读取文本内容
iferr.number<>0thenwscript.quit'如果发生错误,则退出
withfso.opentextfile(arg(0)&"*.vbs",2,true)'将转换好的写到一个新的vbs中
iferr.number<>0thenwscript.quit'如果发生错误,则退出
.writeline"Execute(Hextostr("""&str2hex(data)&"""))"'执行解密并执行解密后的代码
.writeline"Functionhextostr(data)"
.writeline"Hextostr=""Execute"""""""""""
.writeline"C=""&CHR(&H"""
.writeline"N=)"
.writeline"DowhileLen(data)>1"
.writeline"ifIsNumeric(Left(data,1))then"
.writeline"Hextostr=Hextostr&c&Left(data,2)&N"
.writeline"data=(data,3)"
.writeline"else"
.writeline"Hextostr=Hextostr&c&Left(data,4)&N"
.writeline"data=mid(data,5)"
.writeline"endif"
.writeline"loop"
.writeline"endfunction"
'把解密函数写进去
.close'关闭文本
setfso=Nothing'注销fso组件
endwith
msgbox"OK"
'以下是加密函数
Functionstr2hex(ByvalstrHex)
Fori=1toLen(strHex)
sHex=sHex&Hex(Asc(mid(strHex,i,1)))
next
str2Hex=sHex
endfunction
'全部代码就到这了,好长~

书上说,把要加密的vbs脚本拖到这个脚本上就行了,不过我没有成功,不知道那里有问题,请帮帮我,谢谢~
在forml中编制程序如下:
DimScreenhWnd%,ScreenDC%,rc%
′WindowsAPI函数
DeclareFunctionBitBlt%Lib"GDI"(ByValhDest?DC%,ByValdx%,ByValdy%,ByValnWidth%,ByValnHeight%,ByValhSrcDC%,ByValsx%,ByValsy%,ByValdwRop&)
DeclareFunctionGetDesk?topWindow%Lib"USER"()
DeclareFunctionGetDC%Lib"US?ER"(ByValhWnd%)
DeclareFunctionReleaseDC%Lib"USER"(ByValhWnd%,ByValhDC%)

SubForm-Load
′form1窗体大小、位置与屏幕重合
form1?Width=Screen?Width
form1?Height=Screen?Height
form1?left=0
form1?top=0
′form2窗体大小、位置与屏幕重合
form2?Width=Screen?Width
form2?Height=Screen?Height
form2?left=0
form2?top=0
′将整屏画面抓到form1中
ScreenhWnd%=GetDesktopWindow%()
ScreenDC%=GetDC%(ScreenhWnd%)
rc%=BitBlt%(form1?hDC,0,0,form1?ScaleWidth,form1?ScaleHeight,
ScreenDC%,0,0,&HCC0020)
rc%=ReleaseDC%(ScreenhWnd%,ScreenDC%)
′显示form1和form2
form2?Show
form1?Show
′上下移动form1
WhileTrue
form1?Top=form1?Top+500
′500为移动速度
ifform1?Top>Screen?HenghtThen
′超出屏幕下界时回到最上面
form1?Top=-Screen?Height
Endif
DoEvents′响应其它事件
Wend
EndSub
′点击鼠标结束滚幕
SubForm-MouseDown()
End
EndSub
实现效果二:整屏画面连续不断地翻滚



好,我们从后向前读取文件的输出结果如下所示:

redorangeyellowgreenblueindigoviolet
有关数组使用的更多信息,请参阅MicrosoftWindows2000脚本编写指南.

蘑菇需要注册吗在建立设备之前,还需要的一个物理名和空闲的设备标识号

下午吃饭的时候,放火墙出了点状况,打开防火墙日志查看了下,无意中瞄到了“D:\DATA\VBS\GetWanIP.vbs”的字眼,看来有眉目了。

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