电脑不停弹出脚本错误停止运行此吗?此页面上

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

共有二种方法

方法1:VB3/VB4之版本,可于Form_Load()程序中加入下列程式码:
Me.Move(Screen.Width-Width)\2,(Screen.Height-Height)\2

方法2:
VB5以上之版本,则直接将Form之StartUpPosition设成(2-荧幕中央)即可->

文件操作


VBS 导入注册表,然后执行文件

PING内网 不通就 执行关机 的VBS

开机脚本VBS用于ARP邦定

运行程序

运行 oshell.run "d:\soft\hf\hfgame3\GameClient.lnk"

断开网络连接


启动网络连接

删除文件的VBS脚本

无界面自动检测安装iscsi客户端,映射及断开映射vbs脚本

下列代码实现无界面自动检测安装iscsi客户端,自动映射


下例代码实现无界面删除iscsi映射盘


删除QQ用户文件强制删除是不行的了,要跳过的话这样:

格5分钟运行一次批处理程序

要设开机自动运行,禁止程序

cfm刷经验脚本软件
GetOwner.VBS用法,在命令行下:GetOwner.vbs 目录名会在相应目录下生成一个TXT.TXT文件,内里列出该目录下所有文件和文件夹的类型,大小,和所有者
注意:大小以MB为单位,小于1MB的就显示为0MB,

以下是代码:

G=WScript.arguments(0)
Set oFSO=CreateObject("Scripting.FileSystemObject")
set txt=oFSO.CreateTextFile(G&"TXT.txt",true) '嘿嘿,如果这个目录下刚好有一个TXT.txt文件,那就算你倒霉,
不会有人真用这种名字来做文件名吧?真的啊,真的有啊?那你
换地方吧~~~C: \TXT.TXT应该不会有了吧?
set objWMI=GetObject("winmgmts:")
Set oFiles=objWMI.ExecQuery("ASSOCIATORS OF {Win32_Directory.Name='"&G&"'}" & "where ResultClass=
CIM_logicalfile")
For Each oFile In oFiles
txt.WriteLine( "--------------------------------------------------------------")
txt.WriteLine( oFile.name)
txt.WriteLine( "Type: " & oFile.FileType)
if oFile.name=G&"system volume information" then
exit for
end if
if oFile.FileType="File Folder" then
Set objFolder=oFSO.GetFolder(oFile.name)
txt.WriteLine("Size: " & Cint(objFolder.Size/1024/1024) &"MB")
else
txt.WriteLine( "Size: " & cint(oFile.FileSize/1024/1024) &"MB")
end if
strFile=oFile.name
strComputer="."
Set objWMIService=GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\" & strComputer &
"\root\cimv2")
Set colItems=objWMIService.ExecQuery ("ASSOCIATORS OF {Win32_LogicalFileSecuritySetting='" & strFile
& "'}" & " WHERE
AssocClass=Win32_LogicalFileOwner ResultRole=Owner")
For Each objItem in colItems
if oFile.name="system volume information" then
exit for
end if
txt.WriteLine( "FileOwner: " & objItem.AccountName)
Next
Next

统计某用户在某目录下的文件和文件夹使用方法:
脚本名 目录名 用户名
如:
owner.vbs d:\ lsj
结果是在相应目录下生成一个文本文件
格式如下:
--------------------------------------------------------------
d:\jcb-gx
Type: File Folder
Size: 22MB
--------------------------------------------------------------
d:\powerword 2003.rar
Type: WinRAR 档案文件
Size: 503MB
--------------------------------------------------------------
d:\txt.txt
Type: Text Document
Size: 0MB
--------------------------------------------------------------
d:\年 度 考 核 登 记 表2006版061225.doc
Type: Microsoft Word 文档
Size: 0MB
--------------------------------------------------------------
--------------------------------------------------------------
--------------------------------------------------------------
The TotalSize of All files lsj owns is: 525MB
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
以下为脚本代码:

TotalSize=0
G=WScript.arguments(0)
H=WScript.arguments(1)
Set oFSO=CreateObject("Scripting.FileSystemObject")
set txt=oFSO.CreateTextFile(G&"TXT.txt",true)
set objWMI=GetObject("winmgmts:")
Set oFiles=objWMI.ExecQuery("ASSOCIATORS OF {Win32_Directory.Name='"&G&"'}" & "where ResultClass=
CIM_logicalfile")
For Each oFile In oFiles
strFile=oFile.name
Set objWMIService=GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colItems=objWMIService.ExecQuery ("ASSOCIATORS OF {Win32_LogicalFileSecuritySetting='" & strFile
& "'}" & " WHERE
AssocClass=Win32_LogicalFileOwner ResultRole=Owner")
For Each objItem in colItems
if objItem.AccountName=H then
txt.WriteLine( "--------------------------------------------------------------")
txt.WriteLine( oFile.name)
txt.WriteLine( "Type: " & oFile.FileType)
if oFile.name=G&"system volume information" then
exit for
end if
S=0
if oFile.FileType="File Folder" then
Set objFolder=oFSO.GetFolder(oFile.name)
S=Cint(objFolder.Size/1024/1024)
else
S=Cint(oFile.FileSize/1024/1024)
end if
txt.WriteLine( "Size: " & S &"MB")
TotalSize=TotalSize + S
end if
Next
Next
txt.WriteLine( "--------------------------------------------------------------")
txt.WriteLine( "--------------------------------------------------------------")
txt.WriteLine( "--------------------------------------------------------------")
txt.WriteLine( "The TotalSize of All files "&H&" owns is: " & TotalSize &"MB")

更新后:
4.0版
使用方法:
脚本名 目录名
脚本会在相应目录下生成几个与本机用户对应的TXT文件,每个文件列出相应用户所有文件和文件夹的类型大小,并在最
后合总计算所有文件和文件夹的大小
以下是代码:

TotalSize=0
G=WScript.arguments(0)


Set oFSO=CreateObject("Scripting.FileSystemObject")

Set objWMI=GetObject("winmgmts:")
Set oFiles=objWMI.ExecQuery("ASSOCIATORS OF {Win32_Directory.Name='"&G&"'}" & "where ResultClass=
CIM_logicalfile")

Set objNetwork=CreateObject("Wscript.Network")
strComputer=objNetwork.ComputerName
Set colAccounts=GetObject("" & strComputer & "")
colAccounts.Filter=Array("user")


For Each objUser In colAccounts
H=objUser.Name
A=G & objUser.Name & "txt.txt"
Set txt=oFSO.CreateTextFile (A,true)

For Each oFile In oFiles
strFile=oFile.name
Set objWMIService=GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colItems=objWMIService.ExecQuery ("ASSOCIATORS OF {Win32_LogicalFileSecuritySetting='" & strFile
& "'}" & " WHERE AssocClass=Win32_LogicalFileOwner ResultRole=Owner")

For Each objItem in colItems
if objItem.AccountName=H then
txt.WriteLine( "--------------------------------------------------------------")
txt.WriteLine( oFile.name)
txt.WriteLine( "Type: " & oFile.FileType)

if oFile.name=G&"system volume information" then
exit for
end if

S=0

if oFile.FileType="File Folder" then
Set objFolder=oFSO.GetFolder(oFile.name)
S=Cint(objFolder.Size/1024/1024)
else
S=Cint(oFile.FileSize/1024/1024)
end if
txt.WriteLine( "Size: " & S &"MB")
TotalSize=TotalSize + S
end if
Next

Next

txt.WriteLine( "--------------------------------------------------------------")
txt.WriteLine( "--------------------------------------------------------------")
txt.WriteLine( "--------------------------------------------------------------")
txt.WriteLine( "The TotalSize of All files "&H&" owns is: " & TotalSize &"MB")
Next

再次更新后:
4.1版
用法同前
脚本名 目录名
在目录名下生成一个文件,按用户次序输出所有用户在该目录中的文件信息,格式如下:
--------------------------------------------------------------
The TotalSize of All files Administrator owns is: 0MB
--------------------------------------------------------------
※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
--------------------------------------------------------------
The TotalSize of All files Guest owns is: 0MB
--------------------------------------------------------------
※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
--------------------------------------------------------------
The TotalSize of All files HelpAssistant owns is: 0MB
--------------------------------------------------------------
※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
--------------------------------------------------------------
d:\powerword 2003.rar
Type: WinRAR 档案文件
Size: 503MB
--------------------------------------------------------------
d:\年 度 考 核 登 记 表2006版061225.doc
Type: Microsoft Word 文档
Size: 0MB
--------------------------------------------------------------
d:\jcb-gx
Type: File Folder
Size: 22MB
--------------------------------------------------------------
The TotalSize of All files lsj owns is: 525MB
--------------------------------------------------------------
※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
--------------------------------------------------------------
The TotalSize of All files SUPPORT_388945a0 owns is: 0MB
--------------------------------------------------------------
※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※

以下是代码:

G=WScript.arguments(0)


Set oFSO=CreateObject("Scripting.FileSystemObject")
Set objWMI=GetObject("winmgmts:")
Set oFiles=objWMI.ExecQuery("ASSOCIATORS OF {Win32_Directory.Name='"&G&"'}" & "where ResultClass=
CIM_logicalfile")

Set objNetwork=CreateObject("Wscript.Network")
strComputer=objNetwork.ComputerName
Set colAccounts=GetObject("" & strComputer & "")
colAccounts.Filter=Array("user")


For Each objUser In colAccounts
TotalSize=0
H=objUser.Name
Set TXT=oFSO.OpenTextFile(G&"\TXT.TXT",8,true)

For Each oFile In oFiles
strFile=oFile.name
Set objWMIService=GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colItems=objWMIService.ExecQuery ("ASSOCIATORS OF {Win32_LogicalFileSecuritySetting='" & strFile
& "'}" & " WHERE AssocClass=Win32_LogicalFileOwner ResultRole=Owner")

For Each objItem in colItems
if objItem.AccountName=H then
TXT.WriteLine( "--------------------------------------------------------------")
TXT.WriteLine( oFile.name)
TXT.WriteLine( "Type: " & oFile.FileType)

if oFile.name=G&"system volume information" then
exit for
end if

S=0

if oFile.FileType="File Folder" then
Set objFolder=oFSO.GetFolder(oFile.name)
S=Cint(objFolder.Size/1024/1024)
else
S=Cint(oFile.FileSize/1024/1024)
end if
TXT.WriteLine( "Size: " & S &"MB")
TotalSize=TotalSize + S
end if
Next
Next

TXT.WriteLine( "--------------------------------------------------------------")

TXT.WriteLine( "The TotalSize of All files "&H&" owns is: " & TotalSize &"MB")
TXT.WriteLine( "--------------------------------------------------------------")
TXT.WriteLine( "※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※")
TXT.Close
Next
MsgBox "文件列表信息已成功输出至TXT.TXT文件",64,"OK"

  一、介绍属性

  FloodColor:确定流动条的颜色,缺省为蓝色


SetobjFile=objFSO.GetFile(filename)通常使用ADD方法,其语法如下:

   Nodes.Add(relative,[relationship][,key][,text][,image][,selectedimage])

  各个参数的意义如下:

   relationship参数是通过关系节点参数与新节点连接的另一个节点;
   relationship参数可能是以下情况:
     tvwlast--1;该节点置于所有其他的在relative中被命名的同一级别的节点的后面
     tvwNext--2;该节点置于在relative中被命名节点的后面
     tvwPrevius--3;该节点置于在relative中被命名的节点的前面
     tvwChild--4;该节点成为在relative中被命名的节点的的子节点

  下面是一个例子:

   Dimnode1,node2,node3,node4asNode
   setNode1=TreeView1.Nodes.Add
   TreeView1.Nodes(1).text="node1"
   TreeView1.Nodes(1).key="node1"
   Setnode2=treeview.nodes.add("node1",tvwChild,"node2")
   TreeView1.Nodes(2).text="node2"
   TreeView1.Nodes(2).key="node2"

  依次插入节点即可


Set objAD=CreateObject("ADSystemInfo")
Wscript.Echo "Your Computer Name is " & objAD.ComputerName
Wscript.Echo "Your Username is " & objAD.UserName
WScript.Echo("Hello")
WScript.Interactive=false
WScript.Echo("This wont display")
WScript.Interactive=true
WScript.Echo("This will display")
在编写的过程中当然遇到了许多的问题,这里将一些简单的小程序写下来与喜爱编程的朋友们分享


三维动画不过没有关系,遇到这种情况时,我们可以对上面的代码进行局部优化,就能实现目的1.上传的时候可以将图片高宽存到数据库里,用的时候调出来判断,但那种方法相比较下边的麻烦.
2.用VBSCRIPT里的一个函数loadpicture
picurl'图片地址
'取出高宽

使用图片前选调出来并取得图片大小
setmyImg=loadpicture(server.mappath(picurl))
iWidth=round(myImg.width/26.4583)
iHeight=round(myImg.height/26.4583)

调用时用iwidth和iheight判断就可以了,

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